10 static std::minstd_rand0 u;
18 static std::random_device rd;
30 return generator() & 1;
40 static std::uniform_int_distribution<int> d;
41 using parm_t =
decltype(d)::param_type;
52 static std::uniform_real_distribution<float> d;
53 using parm_t =
decltype(d)::param_type;
69 static std::uniform_int_distribution<uint32_t> d;
70 using parm_t =
decltype(d)::param_type;
83template<u
int64_t SEED>
89 auto oldState = state;
90 state = oldState * 6364136223846793005ULL + (SEED | 1);
94 auto xorShifted = uint32_t(((oldState >> 18) ^ oldState) >> 27);
95 auto rot = int(oldState >> 59);
96 return (xorShifted >> rot) | (xorShifted << ((-rot) & 31));
100 uint64_t state = SEED;
106 uint32_t b = 1 << 23;
108 return float(u & m) / float(b);
auto & global_urng()
Return reference to a (shared) global random number generator.
void randomize()
Seed the (shared) random number generator.
int random_int(int from, int thru)
Return a random integer in the range [from, thru] (note: closed interval).
uint32_t random_32bit()
Return a random 32-bit value.
constexpr float getCanonicalFloat(uint32_t u)
bool random_bool()
Return a random boolean value.
float random_float(float from, float upto)
Return a random float in the range [from, upto) (note: half-open interval).
constexpr uint32_t operator()()