93 for (
int i=0;i<
p-1;i++)
106 random_num = min+range*new_seed;
120 static int num_of_tests=100000;
122 static int num_of_bins=10;
129 std::vector<int> count;
130 count.resize(num_of_bins);
133 for (
int i=0;i<num_of_bins;i++)
141 for (
int i=0;i<num_of_tests;i++)
144 bin=floor(rn*num_of_bins/max_num);
158 Mdouble expected=num_of_tests/num_of_bins;
160 for (
int i=0;i<num_of_bins;i++)
162 chi_cum=chi_cum+(count[i]-expected)*(count[i]-expected)/expected;
163 std::cout << i <<
" : " << count[i] <<
" : " <<(count[i]-expected)*(count[i]-expected)/expected << std::endl;
166 std::cout << chi_cum << std::endl;
void set_LFGParms(int new_p, int new_q)
This function sets the parametes for the LFG random number generator.
long int a
This are the two parameters that control the LCG random generated.
Mdouble get_LCG(Mdouble min, Mdouble max)
This is a basic Linear Congruential Generator Random.
Mdouble get_RN(Mdouble min, Mdouble max)
This is a random generating routine can be used for initial positions.
Mdouble get_LFG(Mdouble min, Mdouble max)
This is a Laggend Fibonacci Generator.
void seed_LFG()
This seed the LFG.
int type
This is the type of random number generator.
Mdouble test()
This function tests the quality of random numbers, based on the chi-squared test. ...
std::vector< Mdouble > random_seed_LFG
This is the seeds required for the LFG.
long int p
This are the parameters that control the LFG random generator.
unsigned long int random_seed_LCG
This is the initiall seed of the RNG.
Mdouble chi_squared_prob(Mdouble x, int k)
This is the function which actually gives the probability back using a chi squared test...