Discrete Distribution APIs#
Univariate Discrete Distribution Functions#
randbinomial()#
-
void SRANDBINOMIAL(rng_int_t *n, rng_int_t *m, float *p, rng_int_t *state, rng_int_t *x, rng_int_t *info)#
-
void DRANDBINOMIAL(rng_int_t *n, rng_int_t *m, double *p, rng_int_t *state, rng_int_t *x, rng_int_t *info)#
-
void srandbinomial_(rng_int_t *n, rng_int_t *m, float *p, rng_int_t *state, rng_int_t *x, rng_int_t *info)#
-
void drandbinomial_(rng_int_t *n, rng_int_t *m, double *p, rng_int_t *state, rng_int_t *x, rng_int_t *info)#
-
void srandbinomial(rng_int_t n, rng_int_t m, float p, rng_int_t *state, rng_int_t *x, rng_int_t *info)#
-
void drandbinomial(rng_int_t n, rng_int_t m, double p, rng_int_t *state, rng_int_t *x, rng_int_t *info)#
Returns a vector of pseudo-random integers from binomial distribution.
- Parameters:
n – [in] Number of integers to generate, n > 0
m – [in] Number of trials, m >= 0
p – [in] Probability of success, 0 <= p <= 1
state – [inout] On Entry: Current state of the base generator being used. state must have first been initialized with a call to drandinitialize On Exit: State of generator after n- values are generated
x – [out] Vector of n- integers from the binomial distribution, x(n)
info – [out]
Error code
0 = Everything OK
-1 to -4 = Error in parameter, abs(info)
randgeometric()#
-
void SRANDGEOMETRIC(rng_int_t *n, float *p, rng_int_t *state, rng_int_t *x, rng_int_t *info)#
-
void DRANDGEOMETRIC(rng_int_t *n, double *p, rng_int_t *state, rng_int_t *x, rng_int_t *info)#
-
void srandgeometric_(rng_int_t *n, float *p, rng_int_t *state, rng_int_t *x, rng_int_t *info)#
-
void drandgeometric_(rng_int_t *n, double *p, rng_int_t *state, rng_int_t *x, rng_int_t *info)#
-
void srandgeometric(rng_int_t n, float p, rng_int_t *state, rng_int_t *x, rng_int_t *info)#
-
void drandgeometric(rng_int_t n, double p, rng_int_t *state, rng_int_t *x, rng_int_t *info)#
Returns a vector of pseudo-random integers from geometric distribution.
- Parameters:
n – [in] Number of integers to generate, n > 0
p – [in] Distribution parameter, EPS < p <= 1.0, where EPS is the machine precision
state – [inout] On Entry: Current state of the base generator being used. state must have first been initialized with a call to drandinitialize On Exit: State of generator after n- values are generated
x – [out] Vector of n- integers from the geometric distribution, x(n)
info – [out]
Error code
0 = Everything OK
-1 to -3 = Error in parameter, abs(info)
randhypergeometric()#
-
void SRANDHYPERGEOMETRIC(rng_int_t *n, rng_int_t *np, rng_int_t *ns, rng_int_t *m, rng_int_t *state, rng_int_t *x, rng_int_t *info)#
-
void DRANDHYPERGEOMETRIC(rng_int_t *n, rng_int_t *np, rng_int_t *ns, rng_int_t *m, rng_int_t *state, rng_int_t *x, rng_int_t *info)#
-
void srandhypergeometric_(rng_int_t *n, rng_int_t *np, rng_int_t *ns, rng_int_t *m, rng_int_t *state, rng_int_t *x, rng_int_t *info)#
-
void drandhypergeometric_(rng_int_t *n, rng_int_t *np, rng_int_t *ns, rng_int_t *m, rng_int_t *state, rng_int_t *x, rng_int_t *info)#
-
void srandhypergeometric(rng_int_t n, rng_int_t np, rng_int_t ns, rng_int_t m, rng_int_t *state, rng_int_t *x, rng_int_t *info)#
-
void drandhypergeometric(rng_int_t n, rng_int_t np, rng_int_t ns, rng_int_t m, rng_int_t *state, rng_int_t *x, rng_int_t *info)#
Returns a vector of pseudo-random integers from hypergeometric distribution.
- Parameters:
n – [in] Number of integers to generate, n > 0
np – [in] Size of the population, np >= 0
ns – [in] Size of the sample, 0 <= ns <= np
m – [in] Number of ‘specified’ items in the population, 0 <= m <= np
state – [inout] On Entry: Current state of the base generator being used. state must have first been initialized with a call to drandinitialize On Exit: State of generator after n- values are generated
x – [out] Vector of n- integers from the hypergeometric distribution, x(n)
info – [out]
Error code
0 = Everything OK
-1 to -5 = Error in parameter, abs(info)
randnegativebinomial()#
-
void SRANDNEGATIVEBINOMIAL(rng_int_t *n, rng_int_t *m, float *p, rng_int_t *state, rng_int_t *x, rng_int_t *info)#
-
void DRANDNEGATIVEBINOMIAL(rng_int_t *n, rng_int_t *m, double *p, rng_int_t *state, rng_int_t *x, rng_int_t *info)#
-
void srandnegativebinomial_(rng_int_t *n, rng_int_t *m, float *p, rng_int_t *state, rng_int_t *x, rng_int_t *info)#
-
void drandnegativebinomial_(rng_int_t *n, rng_int_t *m, double *p, rng_int_t *state, rng_int_t *x, rng_int_t *info)#
-
void srandnegativebinomial(rng_int_t n, rng_int_t m, float p, rng_int_t *state, rng_int_t *x, rng_int_t *info)#
-
void drandnegativebinomial(rng_int_t n, rng_int_t m, double p, rng_int_t *state, rng_int_t *x, rng_int_t *info)#
Returns a vector of pseudo-random integers from negtive binomial distribution.
- Parameters:
n – [in] Number of integers to generate, n > 0
m – [in] Number of failures, m >= 0
p – [in] Probability of success, 0 <= p < 1
state – [inout] On Entry: Current state of the base generator being used. state must have first been initialized with a call to drandinitialize On Exit: State of generator after n- values are generated
x – [out] Vector of n- integers from the negtive binomial distribution, x(n)
info – [out]
Error code
0 = Everything OK
-1 to -4 = Error in parameter, abs(info)
randpoisson()#
-
void SRANDPOISSON(rng_int_t *n, float *lambda, rng_int_t *state, rng_int_t *x, rng_int_t *info)#
-
void DRANDPOISSON(rng_int_t *n, double *lambda, rng_int_t *state, rng_int_t *x, rng_int_t *info)#
-
void srandpoisson_(rng_int_t *n, float *lambda, rng_int_t *state, rng_int_t *x, rng_int_t *info)#
-
void drandpoisson_(rng_int_t *n, double *lambda, rng_int_t *state, rng_int_t *x, rng_int_t *info)#
-
void srandpoisson(rng_int_t n, float lambda, rng_int_t *state, rng_int_t *x, rng_int_t *info)#
-
void drandpoisson(rng_int_t n, double lambda, rng_int_t *state, rng_int_t *x, rng_int_t *info)#
Returns a vector of pseudo-random integers from poisson distribution.
- Parameters:
n – [in] Number of integers to generate, n > 0
lambda – [in] Distribution parameter, lambda >= 0.0
state – [inout] On Entry: Current state of the base generator being used. state must have first been initialized with a call to drandinitialize On Exit: State of generator after n- values are generated
x – [out] Vector of n- integers from the poisson distribution, x(n)
info – [out]
Error code
0 = Everything OK
-1 to -3 = Error in parameter, abs(info)
randdiscreteuniform()#
-
void SRANDDISCRETEUNIFORM(rng_int_t *n, rng_int_t *a, rng_int_t *b, rng_int_t *state, rng_int_t *x, rng_int_t *info)#
-
void DRANDDISCRETEUNIFORM(rng_int_t *n, rng_int_t *a, rng_int_t *b, rng_int_t *state, rng_int_t *x, rng_int_t *info)#
-
void sranddiscreteuniform_(rng_int_t *n, rng_int_t *a, rng_int_t *b, rng_int_t *state, rng_int_t *x, rng_int_t *info)#
-
void dranddiscreteuniform_(rng_int_t *n, rng_int_t *a, rng_int_t *b, rng_int_t *state, rng_int_t *x, rng_int_t *info)#
-
void sranddiscreteuniform(rng_int_t n, rng_int_t a, rng_int_t b, rng_int_t *state, rng_int_t *x, rng_int_t *info)#
-
void dranddiscreteuniform(rng_int_t n, rng_int_t a, rng_int_t b, rng_int_t *state, rng_int_t *x, rng_int_t *info)#
Returns a vector of pseudo-random integers uniformly distributed between a and b
- Parameters:
n – [in] Number of integers to generate, n > 0
a – [in] Lower limit for distribution
b – [in] Upper limit for distribution
state – [inout] On Entry: Current state of the base generator being used. state must have first been initialized with a call to drandinitialize On Exit: State of generator after n- values are generated
x – [out] Vector of n- integers from the uniform distribution, x(n)
info – [out]
Error code
0 = Everything OK
-1 to -4 = Error in parameter, abs(info)
randgeneraldiscrete()#
-
void SRANDGENERALDISCRETE(rng_int_t *n, float *ref, rng_int_t *state, rng_int_t *x, rng_int_t *info)#
-
void DRANDGENERALDISCRETE(rng_int_t *n, double *ref, rng_int_t *state, rng_int_t *x, rng_int_t *info)#
-
void srandgeneraldiscrete_(rng_int_t *n, float *ref, rng_int_t *state, rng_int_t *x, rng_int_t *info)#
-
void drandgeneraldiscrete_(rng_int_t *n, double *ref, rng_int_t *state, rng_int_t *x, rng_int_t *info)#
-
void srandgeneraldiscrete(rng_int_t n, float *ref, rng_int_t *state, rng_int_t *x, rng_int_t *info)#
-
void drandgeneraldiscrete(rng_int_t n, double *ref, rng_int_t *state, rng_int_t *x, rng_int_t *info)#
Returns a vector of pseudo-random integers from a general discrete distribution
where the distribution is defined by the reference vector.
- Parameters:
n – [in] Number of integers to generate, n > 0
ref – [in] Reference vector as set up by one of the following APIs, drandbinomialreference, drandgeometricreference, drandhypergeometricreference, drandnegativebinomialreference, drandpoissonreference.
state – [inout] On Entry: Current state of the base generator being used. state must have first been initialized with a call to drandinitialize On Exit: State of generator after n- values are generated
x – [out] Vector of n- integers from the binomial distribution, x(n)
info – [out]
Error code
0 = Everything OK
-1 to -3 = Error in parameter, abs(info)
randbinomialreference()#
-
void SRANDBINOMIALREFERENCE(rng_int_t *m, float *p, float *ref, rng_int_t *lref, rng_int_t *info)#
-
void DRANDBINOMIALREFERENCE(rng_int_t *m, double *p, double *ref, rng_int_t *lref, rng_int_t *info)#
-
void srandbinomialreference_(rng_int_t *m, float *p, float *ref, rng_int_t *lref, rng_int_t *info)#
-
void drandbinomialreference_(rng_int_t *m, double *p, double *ref, rng_int_t *lref, rng_int_t *info)#
-
void srandbinomialreference(rng_int_t m, float p, float *ref, rng_int_t *lref, rng_int_t *info)#
-
void drandbinomialreference(rng_int_t m, double p, double *ref, rng_int_t *lref, rng_int_t *info)#
Setsup a double precision reference vector for generating a vector of random variates from a binomial distribution via calls to drandgeneraldiscrete.
- Parameters:
m – [in] Number of trials, m >= 0
p – [in] Probability of success, 0 <= p < 1
ref – [out] Reference vector, ref(lref)
lref – [inout] On Entry: Either -1, or Length of ref. lref >= 30+20*SQRT(m*p*(1-p)) On Exit: If lref = -1 then lref is set to a recommended value and the function returns; otherwise lref is not altered
info – [out]
Error code
1 = Everything OK, but reference vector not set up due to lref being -1 on entry
0 = Everything OK
-1 to -4 = Error in parameter, abs(info)
randgeometricreference()#
-
void SRANDGEOMETRICREFERENCE(float *p, float *ref, rng_int_t *lref, rng_int_t *info)#
-
void DRANDGEOMETRICREFERENCE(double *p, double *ref, rng_int_t *lref, rng_int_t *info)#
-
void srandgeometricreference_(float *p, float *ref, rng_int_t *lref, rng_int_t *info)#
-
void drandgeometricreference_(double *p, double *ref, rng_int_t *lref, rng_int_t *info)#
-
void srandgeometricreference(float p, float *ref, rng_int_t *lref, rng_int_t *info)#
-
void drandgeometricreference(double p, double *ref, rng_int_t *lref, rng_int_t *info)#
Setsup a double precision reference vector for generating a vector of random variates from a geometric distribution via calls to drandgeneraldiscrete.
- Parameters:
p – [in] Distribution parameter, EPS < p <= 1.0 where EPS is the machine precision
ref – [out] Reference vector, ref(lref)
lref – [inout] On Entry: Either -1, or Length of ref. lref >= RNG_INT_T(30/p)+8 On Exit: If lref = -1 then lref is set to a recommended value and the function returns; otherwise lref is not altered
info – [out]
Error code
1 = Everything OK, but reference vector not set up, due to lref being -1 on entry
0 = Everything OK
-1 to -3 = Error in parameter, abs(info)
randhypergeometricreference()#
-
void SRANDHYPERGEOMETRICREFERENCE(rng_int_t *np, rng_int_t *ns, rng_int_t *m, float *ref, rng_int_t *lref, rng_int_t *info)#
-
void DRANDHYPERGEOMETRICREFERENCE(rng_int_t *np, rng_int_t *ns, rng_int_t *m, double *ref, rng_int_t *lref, rng_int_t *info)#
-
void srandhypergeometricreference_(rng_int_t *np, rng_int_t *ns, rng_int_t *m, float *ref, rng_int_t *lref, rng_int_t *info)#
-
void drandhypergeometricreference_(rng_int_t *np, rng_int_t *ns, rng_int_t *m, double *ref, rng_int_t *lref, rng_int_t *info)#
-
void srandhypergeometricreference(rng_int_t np, rng_int_t ns, rng_int_t m, float *ref, rng_int_t *lref, rng_int_t *info)#
-
void drandhypergeometricreference(rng_int_t np, rng_int_t ns, rng_int_t m, double *ref, rng_int_t *lref, rng_int_t *info)#
Setsup a double precision reference vector for generating a vector of random variates from a hypergeometric distribution via calls to drandgeneraldiscrete.
- Parameters:
np – [in] Size of the population, np >= 0
ns – [in] Size of the sample, 0 <= ns <= np
m – [in] Number of ‘specified’ items in the population, 0 <= m <= np
ref – [out] Reference vector, ref(lref)
lref – [inout] On Entry: Either -1, or Length of ref. lref >= complicated formula On Exit: If lref = -1 then lref is set to a recommended value and the function returns; otherwise, lref is not altered
info – [out]
Error code
1 = Everything OK, but reference vector not set up, due to lref being -1 on entry
0 = Everything OK
-1 to -5 = Error in parameter, abs(info)
randnegativebinomialreference()#
-
void SRANDNEGATIVEBINOMIALREFERENCE(rng_int_t *m, float *p, float *ref, rng_int_t *lref, rng_int_t *info)#
-
void DRANDNEGATIVEBINOMIALREFERENCE(rng_int_t *m, double *p, double *ref, rng_int_t *lref, rng_int_t *info)#
-
void srandnegativebinomialreference_(rng_int_t *m, float *p, float *ref, rng_int_t *lref, rng_int_t *info)#
-
void drandnegativebinomialreference_(rng_int_t *m, double p, double *ref, rng_int_t *lref, rng_int_t *info)#
-
void srandnegativebinomialreference(rng_int_t m, float p, float *ref, rng_int_t *lref, rng_int_t *info)#
-
void drandnegativebinomialreference(rng_int_t m, double p, double *ref, rng_int_t *lref, rng_int_t *info)#
Setsup a double precision reference vector for generating a vector of random variates from a negative binomial distribution via calls to drandgeneraldiscrete.
- Parameters:
m – [in] Number of failures, m >= 0
p – [in] Probability of success, 0 <= p < 1
ref – [out] Reference vector, ref(lref)
lref – [inout]
On Entry: Either -1, or Length of ref.
lref >= RNG_INT_T((m*p+7.15*SQRT(m*p)+20.15*p)/(1-p)+8.5) \
max(0,RNG_INT_T((m*p-7.15*SQRT(m*p))/(1-p))) + 8
On Exit: If
lref = -1 then lref is set to a recommended value and the function returns; otherwise lref is not altered
info – [out]
Error code
1 = Everything OK, but reference vector not set up, due to lref being -1 on entry
0 = Everything OK
-1 to -4 = Error in parameter, abs(info)
randpoissonreference()#
-
void SRANDPOISSONREFERENCE(float *lambda, float *ref, rng_int_t *lref, rng_int_t *info)#
-
void DRANDPOISSONREFERENCE(double *lambda, double *ref, rng_int_t *lref, rng_int_t *info)#
-
void srandpoissonreference_(float *lambda, float *ref, rng_int_t *lref, rng_int_t *info)#
-
void drandpoissonreference_(double *lambda, double *ref, rng_int_t *lref, rng_int_t *info)#
-
void srandpoissonreference(float lambda, float *ref, rng_int_t *lref, rng_int_t *info)#
-
void drandpoissonreference(double lambda, double *ref, rng_int_t *lref, rng_int_t *info)#
Setsup a double precision reference vector for generating a vector of random variates from a poisson distribution via calls to drandgeneraldiscrete.
- Parameters:
lambda – [in] Poisson parameter, lambda >= 0.0
ref – [out] Reference vector, ref(lref)
lref – [inout] On Entry: Either -1, or Length of ref. lref >= 30 + 20*SQRT(lambda) On Exit: If lref = -1 then lref is set to a recommended value and the function returns; otherwise lref is not altered
info – [out]
Error code
1 = Everything OK, but reference vector not set up, due to lref being -1 on entry
0 = Everything OK
-1 to -3 = Error in parameter, abs(info)
Multivariate Discrete Distribution Functions#
randmultinomial()#
-
void SRANDMULTINOMIAL(rng_int_t *n, rng_int_t *m, float *p, rng_int_t *k, rng_int_t *state, rng_int_t *x, rng_int_t *ldx, rng_int_t *info)#
-
void DRANDMULTINOMIAL(rng_int_t *n, rng_int_t *m, double *p, rng_int_t *k, rng_int_t *state, rng_int_t *x, rng_int_t *ldx, rng_int_t *info)#
-
void srandmultinomial_(rng_int_t *n, rng_int_t *m, float *p, rng_int_t *k, rng_int_t *state, rng_int_t *x, rng_int_t *ldx, rng_int_t *info)#
-
void drandmultinomial_(rng_int_t *n, rng_int_t *m, double *p, rng_int_t *k, rng_int_t *state, rng_int_t *x, rng_int_t *ldx, rng_int_t *info)#
-
void srandmultinomial(rng_int_t n, rng_int_t m, float *p, rng_int_t k, rng_int_t *state, rng_int_t *x, rng_int_t ldx, rng_int_t *info)#
-
void drandmultinomial(rng_int_t n, rng_int_t m, double *p, rng_int_t k, rng_int_t *state, rng_int_t *x, rng_int_t ldx, rng_int_t *info)#
Returns an array of pseudo-random integers from a multinomial distribution.
- Parameters:
n – [in] Number of integers generated, n > 0
m – [in] Number of trials, m >= 0
p – [in] Vector of probabilities, where p(i) is the probability of observing outcome i. 0 <= p(i) <= 1, for all i and p(1)+…+p(k) = 1, p(k)
k – [in] Number of possible outcomes, k >= 2
state – [inout] On Entry: Current state of the base generator being used. state must have first been initialized with a call to drandinitialize On Exit: State of generator after n- values are generated
x – [out] Array of n- values from the multinomial distribution, x(ldx,k)
ldx – [in] Lead dimension of x in the calling routine, ldx >= n
info – [out]
Error code
0 = Everything OK
-1 to -7 = Error in parameter, abs(info)