Main docs: Home
Classes | |
class | pw::random::RandomGenerator |
class | pw::random::XorShiftStarRng64 |
Functions | |
template<class T > | |
void | pw::random::RandomGenerator::GetInt (T &dest) |
template<class T > | |
void | pw::random::RandomGenerator::GetInt (T &dest, const T &exclusive_upper_bound) |
virtual void | pw::random::RandomGenerator::Get (ByteSpan dest)=0 |
virtual void | pw::random::RandomGenerator::InjectEntropyBits (uint32_t data, uint_fast8_t num_bits)=0 |
void | pw::random::RandomGenerator::InjectEntropy (ConstByteSpan data) |
Injects entropy into the pool byte-by-byte. | |
pw::random::XorShiftStarRng64::XorShiftStarRng64 (uint64_t initial_seed) | |
void | pw::random::XorShiftStarRng64::Get (ByteSpan dest) final |
void | pw::random::XorShiftStarRng64::InjectEntropyBits (uint32_t data, uint_fast8_t num_bits) final |
|
inlinefinalvirtual |
Populates the destination buffer with a randomly generated value.
This generator uses entropy-seeded PRNG to never exhaust its random number pool.
Implements pw::random::RandomGenerator.
|
pure virtual |
Populates the destination buffer with a randomly generated value.
[out] | dest | The destination buffer. |
Implemented in pw::random::XorShiftStarRng64.
|
inline |
Calculates a uniformly distributed random number in the range [0, exclusive_upper_bound)
.
This avoids modulo biasing. Uniformity is only guaranteed if the underlying generator generates uniform data. Uniformity is achieved by generating new random numbers until one is generated in the desired range (with optimizations).
[out] | dest | The destination to populate the random number into. |
[in] | exclusive_upper_bound | The largest number that can be populated into dest , exclusive. |
|
inlinefinalvirtual |
Injects entropy by rotating the state by the number of entropy bits before XORing the entropy with the current state.
This technique ensures that seeding the random value with single bits will progressively fill the state with more entropy.
Implements pw::random::RandomGenerator.
|
pure virtual |
Injects entropy into the pool.
[in] | data | Up to 32 bits of random entropy data. |
[in] | num_bits | The number of bits of entropy. If less than 32 , entropy is assumed to be stored in the least significant bits of data . |
Implemented in pw::random::XorShiftStarRng64.