Multivariate Point Process Package
0.1
|
A simple C++ random number generator from John D. Cook. More...
#include "include/SimpleRNG.h"
Public Member Functions | |
SimpleRNG () | |
void | SetState (unsigned int u, unsigned int v) |
Seed the random number generator. More... | |
void | GetState (unsigned int &u, unsigned int &v) |
Extract the internal state of the generator. More... | |
double | GetUniform () |
unsigned int | GetUint () |
double | GetUniform (unsigned int &u, unsigned int &v) |
unsigned int | GetUint (unsigned int &u, unsigned int &v) |
double | GetNormal (double mean, double standardDeviation) |
double | GetExponential (double mean) |
double | GetGamma (double shape, double scale) |
double | GetChiSquare (double degreesOfFreedom) |
double | GetInverseGamma (double shape, double scale) |
double | GetWeibull (double shape, double scale) |
double | GetCauchy (double median, double scale) |
double | GetStudentT (double degreesOfFreedom) |
double | GetLaplace (double mean, double scale) |
double | GetLogNormal (double mu, double sigma) |
double | GetBeta (double a, double b) |
int | GetPoisson (double lambda) |
A simple C++ random number generator from John D. Cook.
Definition at line 12 of file SimpleRNG.h.
SimpleRNG::SimpleRNG | ( | ) |
Definition at line 13 of file SimpleRNG.cc.
double SimpleRNG::GetBeta | ( | double | a, |
double | b | ||
) |
Beta sample
a | the shape parameter |
b | the shape parameter |
Definition at line 205 of file SimpleRNG.cc.
double SimpleRNG::GetCauchy | ( | double | median, |
double | scale | ||
) |
Cauchy sample
median | the median parameter |
scale | the scale parameter |
Definition at line 159 of file SimpleRNG.cc.
double SimpleRNG::GetChiSquare | ( | double | degreesOfFreedom | ) |
Chi-square sample
degreesOfFreedom | parameter of the ChiSquare distribution |
Definition at line 133 of file SimpleRNG.cc.
double SimpleRNG::GetExponential | ( | double | mean = 1.0 | ) |
Exponential random sample
mean | the expectation of exponential distribution |
Definition at line 79 of file SimpleRNG.cc.
double SimpleRNG::GetGamma | ( | double | shape, |
double | scale | ||
) |
Gamma random sample
shape | the shape parameter |
scale | the scale parameter |
Definition at line 91 of file SimpleRNG.cc.
double SimpleRNG::GetInverseGamma | ( | double | shape, |
double | scale | ||
) |
Inverse-gamma sample
shape | the shape parameter |
scale | the scale parameter |
Definition at line 140 of file SimpleRNG.cc.
double SimpleRNG::GetLaplace | ( | double | mean, |
double | scale | ||
) |
The Laplace distribution is also known as the double exponential distribution.
mean | the expectation of the distribution |
scale | the scale parameter |
Definition at line 192 of file SimpleRNG.cc.
double SimpleRNG::GetLogNormal | ( | double | mu, |
double | sigma | ||
) |
Log-normal sample
mu | the location parameter |
sigma | the scale parameter |
Definition at line 200 of file SimpleRNG.cc.
double SimpleRNG::GetNormal | ( | double | mean = 0.0 , |
double | standardDeviation = 1.0 |
||
) |
Normal (Gaussian) random sample.
mean | the expectation of Gaussian |
standardDeviation | the standard deviation of Gaussian |
Definition at line 61 of file SimpleRNG.cc.
int SimpleRNG::GetPoisson | ( | double | lambda | ) |
Poisson sample
lambda | expectation of Poisson distribution |
Definition at line 225 of file SimpleRNG.cc.
void SimpleRNG::GetState | ( | unsigned int & | u, |
unsigned int & | v | ||
) |
Extract the internal state of the generator.
[out] | u | internal seed |
[out] | v | internal seed |
Definition at line 29 of file SimpleRNG.cc.
double SimpleRNG::GetStudentT | ( | double | degreesOfFreedom | ) |
Student-t sample
degreesOfFreedom | degree of freedom |
Definition at line 175 of file SimpleRNG.cc.
unsigned int SimpleRNG::GetUint | ( | ) |
A uniform random sample from the set of unsigned integers
Definition at line 55 of file SimpleRNG.cc.
unsigned int SimpleRNG::GetUint | ( | unsigned int & | u, |
unsigned int & | v | ||
) |
This stateless version makes it more convenient to get a random unsigned integer and transfer the state in and out in one operation.
u | internal state |
v | internal state |
Definition at line 43 of file SimpleRNG.cc.
double SimpleRNG::GetUniform | ( | ) |
A uniform random sample from the open interval (0, 1)
Definition at line 50 of file SimpleRNG.cc.
double SimpleRNG::GetUniform | ( | unsigned int & | u, |
unsigned int & | v | ||
) |
Get a uniform random value.
This stateless version makes it more convenient to get a uniform random value and transfer the state in and out in one operation.
[out] | u | internal state |
[out] | v | internal state |
Definition at line 35 of file SimpleRNG.cc.
double SimpleRNG::GetWeibull | ( | double | shape, |
double | scale | ||
) |
Weibull sample
shape | the shape parameter |
scale | the scale parameter |
Definition at line 147 of file SimpleRNG.cc.
void SimpleRNG::SetState | ( | unsigned int | u, |
unsigned int | v | ||
) |
Seed the random number generator.
[in] | u | random seed |
[in] | v | random seed |
Definition at line 21 of file SimpleRNG.cc.