20 _mersenne(seed != 0 ? seed : get_next_seed())
29 _mersenne(copy._mersenne)
38 _mersenne = copy._mersenne;
54 return (range * _mersenne.get_uint31()) / ((
double)0x80000000);
70 if (!_got_first_seed) {
71 _next_seed =
Mersenne((
unsigned long)time(
nullptr));
72 _got_first_seed =
true;
74 return _next_seed.get_uint31();
83 return _mersenne.get_uint31();
double random_real_unit()
Returns a random double in the range [-0.5, 0.5).
static unsigned long get_next_seed()
Returns a random seed value for the next global Randomizer object.
unsigned long get_seed()
Returns a unique seed value based on the seed value passed to this Randomizer object (and on its curr...
double random_real(double range)
Returns a random double in the range [0, range).
int random_int(int range)
Returns a random integer in the range [0, range).
A handy class to return random numbers.
Randomizer(unsigned long seed=0)
If seed is nonzero, it is used to define the tables; if it is zero a random seed is generated.