class RandomGenerator

Defined at line 36 of file ../../third_party/pigweed/src/pw_random/public/pw_random/random.h

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:

* DO assume a generator will always succeed.

* DO NOT assume a generator is cryptographically secure.

* DO NOT assume uniformity of generated data.

Public Methods

void Get (ByteSpan dest)

Populates the destination buffer with a randomly generated value.

Parameters

dest [out] The destination buffer.
void ~RandomGenerator ()

Defined at line 38 of file ../../third_party/pigweed/src/pw_random/public/pw_random/random.h

template <class T>
void GetInt (T & dest)

Defined at line 41 of file ../../third_party/pigweed/src/pw_random/public/pw_random/random.h

template <class T>
void GetInt (T & dest, const T & exclusive_upper_bound)

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).

Parameters

dest [out] The destination to populate the random number into.
exclusive_upper_bound [in] The largest number that can bepopulated into `dest`, exclusive.

Defined at line 60 of file ../../third_party/pigweed/src/pw_random/public/pw_random/random.h

void InjectEntropy (ConstByteSpan data)

Injects entropy into the pool byte-by-byte.

Defined at line 103 of file ../../third_party/pigweed/src/pw_random/public/pw_random/random.h

void InjectEntropyBits (uint32_t data, uint_fast8_t num_bits)

Injects entropy into the pool.

Parameters

data [in] Up to 32 bits of random entropy data.
num_bits [in] The number of bits of entropy. If less than `32`,entropy is assumed to be stored in the least significant bits of `data`.