18 #ifndef INCLUDED_MATHS_RANDOM
19 #define INCLUDED_MATHS_RANDOM
47 b = a ^ c ^ (a << 16) ^ (c << 15);
51 d = a ^ ((a << 5) & 0xDA442D24UL);
54 state[
index] = a ^ b ^ d ^ (a << 2) ^ (b << 18) ^ (c << 28);
64 state[0] = value & mask;
66 state[i] = (1812433253UL * (
state[i - 1] ^ (
state[i - 1] >> 30)) + i) & mask;
83 return std::numeric_limits<uint32_t>::min();
88 return std::numeric_limits<uint32_t>::max();
110 template<
class CharT,
class Traits>
111 friend std::basic_ostream<CharT, Traits>&
112 operator<<(std::basic_ostream<CharT, Traits>& os,
const WELL512&
rng)
114 os <<
rng.index <<
" ";
116 os <<
rng.state[i] <<
" ";
120 template<
class CharT,
class Traits>
121 friend std::basic_istream<CharT, Traits>&
124 is >> rng.
index >> std::ws;
126 is >> rng.
state[i] >> std::ws;
131 #endif // INCLUDED_MATHS_RANDOM
friend bool operator==(const WELL512 &x, const WELL512 &y)
friend std::basic_istream< CharT, Traits > & operator>>(std::basic_istream< CharT, Traits > &is, WELL512 &rng)
void seed(uint32_t value)
Random number generator with period 2^{512}-1; effectively a better version of MT19937 (smaller state...
boost::mt19937 rng
Random number generator (Boost Mersenne Twister)
void seed(uint32_t values[16])
friend bool operator!=(const WELL512 &x, const WELL512 &y)