tenzr::random::Generator¶
Mutex-protected pseudo-random number generator built on a 64-bit Mersenne twister.
#include <generator.h>
Public Functions¶
| Name | |
|---|---|
| Generator() Construct a generator seeded from the system randomness source. |
|
| Generator(uint64_t seed) | |
| void | ManualSeed(uint64_t seed) |
| void | SeedRandom() Reseed the generator from a non-deterministic source. |
| uint64_t | CurrentSeed() const |
| uint64_t | NextUint64() |
| double | NextDouble() |
| float | NextFloat() |
| std::mt19937_64 & | Engine() |
Public Functions Documentation¶
function Generator¶
Construct a generator seeded from the system randomness source.
function Generator¶
Parameters:
- seed Seed for the underlying engine.
Construct a generator with a deterministic seed.
function ManualSeed¶
Parameters:
- seed New seed.
- seed New seed value.
Reseed the generator deterministically. Reseed the engine deterministically.
function SeedRandom¶
Reseed the generator from a non-deterministic source.
Reseed the engine from std::random_device.
function CurrentSeed¶
Return: Seed the generator was constructed or reseeded with.
function NextUint64¶
Return:
- Next 64-bit random word.
- Pseudorandom 64-bit integer.
Draw the next 64-bit value.
function NextDouble¶
Return: Pseudorandom double.
Draw a uniform double in [0, 1).
function NextFloat¶
Return: Pseudorandom float.
Draw a uniform float in [0, 1).
function Engine¶
Return: Mutable reference to the underlying engine.