|
|
| LCRand (uint64_t seed) |
| |
| virtual uint32_t | rand32 () |
| |
| virtual void | rseed (uint64_t seed) |
| | Reset the generator's state with the bits of seed as its source of entropy.
|
| |
| uint64_t | rand64 () |
| |
| template<typename T> |
| T | rand () |
| |
| template<typename T> |
| T | rand (T max) |
| |
| template<typename T> |
| T | rand (T lo, T hi) |
| |
|
template<> |
| bool | rand () |
| |
|
template<> |
| unsigned int | rand () |
| |
|
template<> |
| int | rand () |
| |
|
template<> |
| unsigned long | rand () |
| |
|
template<> |
| long | rand () |
| |
|
template<> |
| unsigned long long | rand () |
| |
|
template<> |
| long long | rand () |
| |
|
template<> |
| float | rand () |
| |
|
template<> |
| double | rand () |
| |
|
template<> |
| unsigned int | rand (unsigned int hi) |
| |
|
template<> |
| int | rand (int hi) |
| |
|
template<> |
| unsigned long | rand (unsigned long hi) |
| |
|
template<> |
| long | rand (long hi) |
| |
|
template<> |
| unsigned long long | rand (unsigned long long hi) |
| |
|
template<> |
| long long | rand (long long hi) |
| |
|
template<> |
| float | rand (float hi) |
| |
|
template<> |
| double | rand (double hi) |
| |
|
template<> |
| int | rand (int lo, int hi) |
| |
|
template<> |
| long long | rand (long long lo, long long hi) |
| |
|
template<> |
| float | rand (float lo, float hi) |
| |
|
template<> |
| double | rand (double lo, double hi) |
| |
| template<> |
| bool | rand () |
| |
| template<> |
| unsigned int | rand () |
| |
| template<> |
| int | rand () |
| |
| template<> |
| unsigned long | rand () |
| |
| template<> |
| long | rand () |
| |
| template<> |
| unsigned long long | rand () |
| |
| template<> |
| long long | rand () |
| |
| template<> |
| float | rand () |
| |
| template<> |
| double | rand () |
| |
| template<> |
| unsigned int | rand (unsigned int hi) |
| |
| template<> |
| int | rand (int hi) |
| |
| template<> |
| unsigned long | rand (unsigned long hi) |
| |
| template<> |
| long | rand (long hi) |
| |
| template<> |
| unsigned long long | rand (unsigned long long hi) |
| |
| template<> |
| long long | rand (long long hi) |
| |
| template<> |
| float | rand (float hi) |
| |
| template<> |
| double | rand (double hi) |
| |
| template<> |
| int | rand (int lo, int hi) |
| |
| template<> |
| long long | rand (long long lo, long long hi) |
| |
| template<> |
| float | rand (float lo, float hi) |
| |
| template<> |
| double | rand (double lo, double hi) |
| |
Implements a linear congruential pseudorandom number generator with period 264.
The parameters are the same as those chosen for Donald Knuth's MMIX language:
multiplier: 6364136223846793005
increment: 1442695040888963407
The underlying state is 64 bits; rand32() returns the 32 most significant digits.
The results of this generator are very fast and generally higher-quality and longer-period than those returned by std::rand().
This generator is NOT cryptographically secure; do NOT use for gambling or cryptography. An attacker may predict all future numbers by observing one or two results.
Produces a (pseudo-) random T with uniform distribution over the unit interval, if the unit interval is populated by T; or with uniform distribution over the entire space of possible T otherwise.
For example, rand<float>() returns a random float between 0 and 1.0, while rand<unsigned int>() returns a random uint between 0 and UINT_MAX.
Generate a floating-point value with uniform distribution between 0 and 1.0.
This method is preferable to use over the common practice of rand<int>() / (float)INT_MAX, as the latter excludes a large fraction of the representable floating point numbers between 0.0 and 1.0 (particularly those near zero), resulting in reduced entropy.
This method produces a number by carefully picking the bits of the exponent and mantissa explicitly, in such a way that the distibution remains uniform.
Generate a floating-point value with uniform distribution between 0 and 1.0.
This method is preferable to use over the common practice of rand<int>() / (float)INT_MAX, as the latter excludes a large fraction of the representable floating point numbers between 0.0 and 1.0 (particularly those near zero), resulting in reduced entropy.
This method produces a number by carefully picking the bits of the exponent and mantissa explicitly, in such a way that the distibution remains uniform.