58 #define MATRIX_A 0x9908b0dfUL
59 #define UPPER_MASK 0x80000000UL
60 #define LOWER_MASK 0x7fffffffUL
73 mt=
new unsigned long [
N];
76 mt[0]= s & 0xffffffffUL;
83 mt[
mti] &= 0xffffffffUL;
108 unsigned long s=seed;
109 mt[0]= s & 0xffffffffUL;
116 mt[
mti] &= 0xffffffffUL;
137 static unsigned long mag01[2]={0x0UL,
MATRIX_A};
148 mt[kk] =
mt[kk+
M] ^ (y >> 1) ^ mag01[y & 0x1UL];
152 mt[kk] =
mt[kk+(M-
N)] ^ (y >> 1) ^ mag01[y & 0x1UL];
155 mt[N-1] =
mt[M-1] ^ (y >> 1) ^ mag01[y & 0x1UL];
164 y ^= (y << 7) & 0x9d2c5680UL;
165 y ^= (y << 15) & 0xefc60000UL;
168 return (((
double)y) + 0.5)*(1.0/4294967296.0);
211 cerr <<
"Error in dvar_vector::fill_randbi proportions of"
212 " successes must lie between 0 and 1\n";
272 (*this)(i)=
randn(rng);
void reinitialize(const int seed)
Reinitialize random number seed.
void fill_randn(const random_number_generator &rng)
Description not yet available.
~random_number_generator()
Destructor.
int indexmin() const
Get minimum valid index.
void fill_randn(long int &n)
Fill matrix with random numbers.
void fill_randu(long int &n)
Fill vector with random numbers.
void colfill_randn(const int &j, long int &n)
Fill random numbers into specified column j of matrix.
double better_rand()
Random number generator.
double randu(const random_number_generator &rng)
Uniform random number generator.
void fill_randn(long int &n)
Fill vector with random numbers.
Description not yet available.
d3_array sqrt(const d3_array &arr3)
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
void fill_randu(long int &n)
Fill matrix with random numbers.
int indexmax() const
Get maximum valid index.
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
void fill_randbi(long int &n, double)
Fill vector with binary random numbers.
unsigned long * mt
the array for the state vector
random_number_generator(const int seed)
Constructor for random_number_generator class.
d3_array cos(const d3_array &arr3)
Returns d3_array results with computed cos from elements in arr3.
double randn(const random_number_generator &rng)
Normal number generator.
int mti
mti==N+1 means mt[N] is not initialized
void colfill_randu(const int &j, long int &n)
Fill random numbers into specified column j of matrix.
void rowfill_randn(const int &i, long int &n)
Fill random numbers into specified row i of matrix.
void fill_randu(const random_number_generator &rng)
Description not yet available.
d3_array log(const d3_array &arr3)
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
void rowfill_randu(const int &i, long int &n)
Fill random numbers into specified row i of matrix.