LibRan
0.1
Pseudo-random number distribution generator
|
The Gaussian (Normal) distributions centered on m and width given by 2s. More...
Go to the source code of this file.
Functions | |
double | LRd_gausbm_RAN (LR_obj *o) |
LRd_gausbm_RAN(LR_obj *o) - double random Gaussian/Normal distribution using the Box-Muller method. More... | |
double | LRd_gausmar_RAN (LR_obj *o) |
LRd_gausmar_RAN(LR_obj *o) - double random Gaussian/Normal distribution using the Marsaglia method with acceptance-rejection. More... | |
double | LRd_gaus_PDF (LR_obj *o, double x) |
LRd_gaus_PDF(LR_obj *o, double x) - double Gaussian/Normal probablity distribution function. More... | |
double | LRd_gaus_CDF (LR_obj *o, double x) |
LRd_gaus_CDF(LR_obj *o, double x) - double Gaussian/Normal cumulative distribution function. More... | |
float | LRf_gausbm_RAN (LR_obj *o) |
LRf_gausbm_RAN(LR_obj *o) - float random Gaussian/Normal distribution using the Box-Muller method. More... | |
float | LRf_gausmar_RAN (LR_obj *o) |
LRf_gausmar_RAN(LR_obj *o) - float random Gaussian/Normal distribution using the Marsaglia method with acceptance-rejection. More... | |
float | LRf_gaus_PDF (LR_obj *o, float x) |
LRf_gaus_PDF(LR_obj *o, float x) - float Gaussian/Normal probablity distribution function. More... | |
float | LRf_gaus_CDF (LR_obj *o, float x) |
LRf_gaus_CDF(LR_obj *o, float x) - float Gaussian/Normal cumulative distribution function. More... | |
The Gaussian (Normal) distributions centered on m and width given by 2s.
The pseudo-random numbers are distributed from a Gaussian or Normal (also Laplace-Gauss) distribution. The mean is given by m and variance = . The normal distribution is a very common continuous probability distribution and is commonly called the bell curve.
The default is m = 0, s = 1; which is called the standard normal distribution.
Gaussian distributed random variates can be generated in a couple of methods. The first is the Box-Muller method which generates a pair of Gaussian distributed random variates by considering the 2-dimensional form of the Gaussian distribution. The polar form can yield itself to using the inverse CDF for generating the random variates. However, this requires using time-intensive math functions such as the sin, cos, log, and sqrt functions.
The second method uses the Marsagalia's polar method with acceptance/rejection for generating random variates confined to the unit circle centered on the origin with radius 1. This gives an acceptance ratio to be , but the method only uses a single sqrt, log, and division per generated pair. This simplicity may result in a faster generator despite the time to calculate rejected samples.
Definition in file LRgaus.c.
double LRd_gaus_CDF | ( | LR_obj * | o, |
double | x | ||
) |
LRd_gaus_CDF(LR_obj *o, double x) - double Gaussian/Normal cumulative distribution function.
o | LR_obj object |
x | value |
double LRd_gaus_PDF | ( | LR_obj * | o, |
double | x | ||
) |
LRd_gaus_PDF(LR_obj *o, double x) - double Gaussian/Normal probablity distribution function.
o | LR_obj object |
x | value |
double LRd_gausbm_RAN | ( | LR_obj * | o | ) |
LRd_gausbm_RAN(LR_obj *o) - double random Gaussian/Normal distribution using the Box-Muller method.
Default values: mean m = 0, std.deviation s = 1
o | LR_obj object |
double LRd_gausmar_RAN | ( | LR_obj * | o | ) |
LRd_gausmar_RAN(LR_obj *o) - double random Gaussian/Normal distribution using the Marsaglia method with acceptance-rejection.
Default values: mean m = 0, std.deviation s = 1
o | LR_obj object |
float LRf_gaus_CDF | ( | LR_obj * | o, |
float | x | ||
) |
LRf_gaus_CDF(LR_obj *o, float x) - float Gaussian/Normal cumulative distribution function.
o | LR_obj object |
x | value |
float LRf_gaus_PDF | ( | LR_obj * | o, |
float | x | ||
) |
LRf_gaus_PDF(LR_obj *o, float x) - float Gaussian/Normal probablity distribution function.
o | LR_obj object |
x | value |
float LRf_gausbm_RAN | ( | LR_obj * | o | ) |
LRf_gausbm_RAN(LR_obj *o) - float random Gaussian/Normal distribution using the Box-Muller method.
Default values: mean m = 0, std.deviation s = 1
o | LR_obj object |
float LRf_gausmar_RAN | ( | LR_obj * | o | ) |
LRf_gausmar_RAN(LR_obj *o) - float random Gaussian/Normal distribution using the Marsaglia method with acceptance-rejection.
Default values: mean m = 0, std.deviation s = 1
o | LR_obj object |