LibRan
0.1
Pseudo-random number distribution generator
|
The Binomial distribution with probability of success p > 0 and n independent tests. More...
Go to the source code of this file.
Functions | |
int | LRi_binomial_RAN (LR_obj *o) |
LRi_binomial_RAN(LR_obj *o) - int Binomial distributed variate. Default values: probability of success p = 1/2. More... | |
float | LRi_binomial_PDF (LR_obj *o, int k) |
LRi_binomial_PDF(LR_obj *o, int k) - Binomial probablity (or mass) distribution function. More... | |
float | LRi_binomial_CDF (LR_obj *o, int k) |
LRi_binomial_CDF(LR_obj *o, int k) - Binomial distribution cumulative distribution function. More... | |
The Binomial distribution with probability of success p > 0 and n independent tests.
The pseudo-random numbers are distributed from the Binomial distribution, which is a discrete distribution describing the number of successful Bernoulli trails in n events. A Bernoulli trial is one characterized by either "success" or "failure." For example, n coin flips where the number of heads is shown is described by the Bimomial distribution. If n is large and p not "extreme" then the distribution will approach the Normal distribution, and these routines may not be as effective. This approach to a Normal distribution is established by the "central limit theorem."
The attribute p is greater than zero and less than one and represents the probability of a successful trial. Therefore, np is the mean number of successful trials in n events and also may not be an integer value.
The default is and q will be set to
for calculation efficiency. Do not set q when declaring this distribution.
Definition in file LRbinom.c.
float LRi_binomial_CDF | ( | LR_obj * | o, |
int | k | ||
) |
LRi_binomial_CDF(LR_obj *o, int k) - Binomial distribution cumulative distribution function.
o | LR_obj object |
x | value |
float LRi_binomial_PDF | ( | LR_obj * | o, |
int | k | ||
) |
LRi_binomial_PDF(LR_obj *o, int k) - Binomial probablity (or mass) distribution function.
o | LR_obj object |
x | value |
int LRi_binomial_RAN | ( | LR_obj * | o | ) |
LRi_binomial_RAN(LR_obj *o) - int Binomial distributed variate. Default values: probability of success p = 1/2.
The random variate is generated using the waiting time property - Generate a number of exponential variates until the waited sum exceeds some value.
o | LR_obj object |