LibRan
0.1
Pseudo-random number distribution generator
|
The Geometric distribution with a probability of success 0 < p < 1. More...
Go to the source code of this file.
Functions | |
int | LRi_geometric_RAN (LR_obj *o) |
LRi_geometric_RAN(LR_obj *o) - int Geometric distributed variate. Default values: probability of success p = 1/2. More... | |
float | LRi_geometric_PDF (LR_obj *o, int x) |
LRi_geometric_PDF(LR_obj *o, int x) - Geometric probablity (or mass) distribution function. More... | |
float | LRi_geometric_CDF (LR_obj *o, int x) |
LRi_geometric_CDF(LR_obj *o, int x) - Geometric distribution cumulative distribution function. More... | |
The Geometric distribution with a probability of success 0 < p < 1.
The pseudo-random numbers are distributed from the Geometric distribution, which is a discrete distribution describing the number of Bernoulli trails until a successful event. A Bernoulli trial is one characterized by either "success" or "failure." For example, the number of coin flips until a heads is shown is described by the Geometric distribution.
The attribute p is greater than zero and less than one and represents the probability of a successful trial. Therefore, 1/p is the mean number of trials until success.
The default is and q will be set to
for calculation efficiency. Do not set q when declaring this distribution.
Definition in file LRgeom.c.
float LRi_geometric_CDF | ( | LR_obj * | o, |
int | x | ||
) |
LRi_geometric_CDF(LR_obj *o, int x) - Geometric distribution cumulative distribution function.
o | LR_obj object |
x | value |
float LRi_geometric_PDF | ( | LR_obj * | o, |
int | x | ||
) |
LRi_geometric_PDF(LR_obj *o, int x) - Geometric probablity (or mass) distribution function.
o | LR_obj object |
x | value |
int LRi_geometric_RAN | ( | LR_obj * | o | ) |
LRi_geometric_RAN(LR_obj *o) - int Geometric distributed variate. Default values: probability of success p = 1/2.
The random variate is generated using inversion and truncation.
o | LR_obj object |