Multivariate Point Process Package  0.1
Public Member Functions | List of all members
SimpleRNG Class Reference

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)
 

Detailed Description

A simple C++ random number generator from John D. Cook.

Definition at line 12 of file SimpleRNG.h.

Constructor & Destructor Documentation

SimpleRNG::SimpleRNG ( )

Definition at line 13 of file SimpleRNG.cc.

Member Function Documentation

double SimpleRNG::GetBeta ( double  a,
double  b 
)

Beta sample

Parameters
athe shape parameter
bthe shape parameter
Returns
a sample from Beta distribution

Definition at line 205 of file SimpleRNG.cc.

double SimpleRNG::GetCauchy ( double  median,
double  scale 
)

Cauchy sample

Parameters
medianthe median parameter
scalethe scale parameter
Returns
a sample from the Cauchy distribution

Definition at line 159 of file SimpleRNG.cc.

double SimpleRNG::GetChiSquare ( double  degreesOfFreedom)

Chi-square sample

Parameters
degreesOfFreedomparameter of the ChiSquare distribution
Returns
a sample from ChiSquare distribution

Definition at line 133 of file SimpleRNG.cc.

double SimpleRNG::GetExponential ( double  mean = 1.0)

Exponential random sample

Parameters
meanthe expectation of exponential distribution
Returns
a sample from the exponential distribution

Definition at line 79 of file SimpleRNG.cc.

double SimpleRNG::GetGamma ( double  shape,
double  scale 
)

Gamma random sample

Parameters
shapethe shape parameter
scalethe scale parameter
Returns
a sample from Gamma distribution

Definition at line 91 of file SimpleRNG.cc.

double SimpleRNG::GetInverseGamma ( double  shape,
double  scale 
)

Inverse-gamma sample

Parameters
shapethe shape parameter
scalethe scale parameter
Returns
a sample from Inverse-gamma distribution

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.

Parameters
meanthe expectation of the distribution
scalethe scale parameter
Returns
a sample from Laplace distribution

Definition at line 192 of file SimpleRNG.cc.

double SimpleRNG::GetLogNormal ( double  mu,
double  sigma 
)

Log-normal sample

Parameters
muthe location parameter
sigmathe scale parameter
Returns
a sample from Log-normal distribution

Definition at line 200 of file SimpleRNG.cc.

double SimpleRNG::GetNormal ( double  mean = 0.0,
double  standardDeviation = 1.0 
)

Normal (Gaussian) random sample.

Parameters
meanthe expectation of Gaussian
standardDeviationthe standard deviation of Gaussian
Returns
a sample from Gaussian

Definition at line 61 of file SimpleRNG.cc.

int SimpleRNG::GetPoisson ( double  lambda)

Poisson sample

Parameters
lambdaexpectation of Poisson distribution
Returns
a sample from 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.

Parameters
[out]uinternal seed
[out]vinternal seed

Definition at line 29 of file SimpleRNG.cc.

double SimpleRNG::GetStudentT ( double  degreesOfFreedom)

Student-t sample

Parameters
degreesOfFreedomdegree of freedom
Returns
a sample from the Student-t distribution

Definition at line 175 of file SimpleRNG.cc.

unsigned int SimpleRNG::GetUint ( )

A uniform random sample from the set of unsigned integers

Returns
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.

Parameters
uinternal state
vinternal state
Returns
a uniform integer sample

Definition at line 43 of file SimpleRNG.cc.

double SimpleRNG::GetUniform ( )

A uniform random sample from the open interval (0, 1)

Returns
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.

Parameters
[out]uinternal state
[out]vinternal state
Returns
a uniform sample from (0, 1)

Definition at line 35 of file SimpleRNG.cc.

double SimpleRNG::GetWeibull ( double  shape,
double  scale 
)

Weibull sample

Parameters
shapethe shape parameter
scalethe scale parameter
Returns
a sample from the Weibull distribution

Definition at line 147 of file SimpleRNG.cc.

void SimpleRNG::SetState ( unsigned int  u,
unsigned int  v 
)

Seed the random number generator.

Parameters
[in]urandom seed
[in]vrandom seed

Definition at line 21 of file SimpleRNG.cc.


The documentation for this class was generated from the following files: