2.1.24.8.17 poissrnd


Description

Generates an array of random integers from a Poisson distribution, seeds and generator number passed explicitly

Syntax

int poissrnd( long * v, uint n, double lamda )

Parameters

v
[output] Pointer to a double array, which contain the results
n
[input] The number of pseudo-random numbers to be generated. n>=1
lamda
[input] The mean ?? of the Poisson distribution

Return

Return NE_NOERROR(0) on success, otherwise error.

Examples

EX1

//This example is to generate pseudo-random numbers from a Poisson distribution
int poissrnd_ex1()
{
    int n = 10;
    long v[10];
 	double lamda=20.0;
					
    int nRet = poissrnd(v, n, lamda);
    
    if(0 != nRet)
    	return 0;
    
    for(int i=0;i<n;i++)
        printf("v[%d]: %d\n",i, v[i]);

    return 1;
}

Remark

See Also

mvnrnd

Header to Include

origin.h

Reference