wblrnd

 

Description

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

Syntax

int wblrnd( double * v, int n, double a, double b )

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 shape parameter, a, of the distribution
b
[input] The scale parameter, b, of the distribution. Note that it is an alternative parameterization of Weibull distribution. For more, see Weibull probability density function.

Return

Return NE_NOERROR(0) on success, otherwise error

Examples

EX1

//This example is to generate pseudo-random numbers from a Weibull distribution
int wblrnd_ex1()
{
    int n = 5;
    vector v(n);
        double a = 1.0, b = 2.0;
                                        
    int nRet = wblrnd( v, n, a, b);
    
    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

mvnrnd

header to Include

origin.h

Reference