hygernd

 

Description

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

Syntax

int hygernd( long * v, uint n, int ns, int np, int m )

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
ns
[input] The sample size, l, of the hypergeometric distribution
np
[input] The population size, n, of the hypergeometric distribution
m
[input] The number of specified items, m, of the hypergeometric distribution

Return

Return NE_NOERROR(0) on success, otherwise error

Examples

EX1

//This example is to generate pseudo-random numbers from a hypergeometric distribution
int hygernd_ex1()
{
    int n = 10;
    long v[10];
        int m = 900;
        int np = 1000;
        int ns = 500;
                
        int nRet = hygernd( v, n, ns, np, m);
 
    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

binornd

header to Include

origin.h

Reference