2.1.24.8.6 exprnd


Description

Generates an array of random numbers from an exponential distribution, seeds and generator number passed explicitly

Syntax

int exprnd( double * v, uint n, double a )

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
a
[input] The mean, a, of the distribution

Return

Return NE_NOERROR(0) on success, otherwise error.

Examples

EX1

//This example is to generate pseudo-random numbers from an exponential distribution
int exprnd_ex1()
{
    int n = 10;
    vector v( n );
    double a = 1.0;
    
    int nRet = exprnd( v, n, a);
 
    if(0 != nRet)
    	return 0;
    
    for(int i=0;i<n;i++)
        printf("v[%d]: %f\n",i, v[i]);

    return 1;
}

Remark

See Also

binornd

Header to Include

origin.h

Reference