26 #ifndef MECURYDPM_RNG_H
27 #define MECURYDPM_RNG_H
66 void read(std::istream& is);
68 void write(std::ostream& os)
const;
double Mdouble
Definition: GeneralDefine.h:34
RNGType
Definition: RNG.h:39
@ LAGGED_FIBONACCI_GENERATOR
@ LINEAR_CONGRUENTIAL_GENERATOR
This is a class that generates random numbers i.e. named the Random Number Generator (RNG).
Definition: RNG.h:53
RNG()
default constructor
Definition: RNG.cc:36
unsigned long int m_
Definition: RNG.h:164
unsigned long int q_
Definition: RNG.h:169
unsigned int getPoissonVariate(Mdouble lambda)
Produces a random number according to a Poisson distribution.
Definition: RNG.cc:212
void read(std::istream &is)
Definition: RNG.cc:59
Mdouble savedBoxMuller_
A storage space for the so-far-unused variate from the pair generated by Box–Muller.
Definition: RNG.h:190
void setRandomSeed(unsigned long int new_seed)
This is the seed for the random number generator (note the call to seed_LFG is only required really i...
Definition: RNG.cc:53
Mdouble getRandomNumberFromLinearCongruentialGenerator(Mdouble min, Mdouble max)
This is a basic Linear Congruential Generator Random.
Definition: RNG.cc:234
unsigned long int randomSeedLinearCongruentialGenerator_
This is the initial seed of the RNG.
Definition: RNG.h:154
void setLinearCongruentialGeneratorParmeters(const unsigned int a, const unsigned int c, unsigned int m)
This functions set the parameters for the LCG random number generator. It goes multiplier,...
Definition: RNG.cc:91
unsigned long int c_
Definition: RNG.h:164
Mdouble test()
This function tests the quality of random numbers, based on the chi-squared test.
Definition: RNG.cc:289
void write(std::ostream &os) const
Definition: RNG.cc:78
RNGType type_
This is the type of random number generator.
Definition: RNG.h:174
unsigned long int a_
This are the two parameters that control the LCG random generated.
Definition: RNG.h:164
bool haveSavedBoxMuller_
A flag that keeps track of whether or not to generate a new pair of normal variates (using Box–Muller...
Definition: RNG.h:185
Mdouble getNormalVariate()
Produces a random number according to a normal distribution with mean 0 and standard deviation 1.
Definition: RNG.cc:164
Mdouble getRandomNumber()
This is a random generating routine can be used for initial positions.
Definition: RNG.cc:143
Mdouble operator()()
Definition: RNG.h:88
void seedLaggedFibonacciGenerator()
This seed the LFG.
Definition: RNG.cc:253
unsigned long int p_
This are the parameters that control the LFG random generator.
Definition: RNG.h:169
void setLaggedFibonacciGeneratorParameters(const unsigned int p, const unsigned int q)
This function sets the parameters for the LFG random number generator.
Definition: RNG.cc:338
Mdouble getRandomNumberFromLaggedFibonacciGenerator(Mdouble min, Mdouble max)
This is a Lagged Fibonacci Generator.
Definition: RNG.cc:265
std::vector< Mdouble > randomSeedLaggedFibonacciGenerator_
This is the seeds required for the LFG.
Definition: RNG.h:159
void randomise()
sets the random variables such that they differ for each run
Definition: RNG.cc:98
Mdouble operator()(Mdouble min, Mdouble max)
Shorthand for getRandomNumber(min, max)
Definition: RNG.h:80
void setRandomNumberGenerator(RNGType type)
Allows the user to set which random number generator is used.
Definition: RNG.cc:138