#include <random.h>
Public Member Functions | |
template<class T > | |
void | GetInt (T &dest) |
template<class T > | |
void | GetInt (T &dest, const T &exclusive_upper_bound) |
virtual void | Get (ByteSpan dest)=0 |
virtual void | InjectEntropyBits (uint32_t data, uint_fast8_t num_bits)=0 |
void | InjectEntropy (ConstByteSpan data) |
Injects entropy into the pool byte-by-byte. | |
A random generator uses injected entropy to generate random values. Many of the guarantees for this interface are provided at the level of the implementations. In general:
|
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. |
|
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.