38 m_ = 1024 * 1024 * 1024;
105 for (
unsigned int i = 0; i <
p_; i++)
119 for (
unsigned int i = 0; i <
p_ - 1; i++)
130 random_num = min + range * new_seed;
143 static unsigned int num_of_tests = 100000;
144 static Mdouble max_num = 100.0;
145 static unsigned int num_of_bins = 10;
150 unsigned int bin = 0;
152 std::vector<int> count;
153 count.resize(num_of_bins);
156 for (
unsigned int i = 0; i < num_of_bins; i++)
162 for (
unsigned int i = 0; i < num_of_tests; i++)
165 bin =
static_cast<unsigned int>(std::floor(rn * num_of_bins / max_num));
174 Mdouble expected = num_of_tests / num_of_bins;
176 for (
unsigned int i = 0; i < num_of_bins; i++)
178 chi_cum = chi_cum + (count[i] - expected) * (count[i] - expected) / expected;
179 std::cout << i <<
" : " << count[i] <<
" : " << (count[i] - expected) * (count[i] - expected) / expected << std::endl;
182 std::cout << chi_cum << std::endl;
Mdouble chi_squared_prob(const Mdouble x, const unsigned int k)
This is the function which actually gives the probability back using a chi squared test...
Mdouble getRandomNumberFromLaggedFibonacciGenerator(Mdouble min, Mdouble max)
This is a Lagged Fibonacci Generator.
void seedLaggedFibonacciGenerator()
This seed the LFG.
void setLaggedFibonacciGeneratorParameters(const unsigned int p, const unsigned int q)
This function sets the parameters for the LFG random number generator.
void randomise()
sets the random variables such that they differ for each run
void setLinearCongruentialGeneratorParmeters(unsigned const int a, unsigned const int c, unsigned const int m)
This functions set the parameters for the LCG random number generator. It goes multiplier, addition, mod.
Mdouble getRandomNumberFromLinearCongruentialGenerator(Mdouble min, Mdouble max)
This is a basic Linear Congruential Generator Random.
unsigned long int randomSeedLinearCongruentialGenerator_
This is the initial seed of the RNG.
unsigned long int p_
This are the parameters that control the LFG random generator.
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 ...
Mdouble test()
This function tests the quality of random numbers, based on the chi-squared test. ...
std::vector< Mdouble > randomSeedLaggedFibonacciGenerator_
This is the seeds required for the LFG.
unsigned long int a_
This are the two parameters that control the LCG random generated.
void setRandomNumberGenerator(RNGType type)
Allows the user to set which random number generator is used.
RNGType type_
This is the type of random number generator.
Mdouble getRandomNumber(Mdouble min, Mdouble max)
This is a random generating routine can be used for initial positions.