Random Number Generator API. More...
Functions | |
void | get_rand_128 (rng_128_t *rand128) |
Get 128-bit random number. More... | |
uint64_t | get_rand_64 (void) |
Get 64-bit random number. More... | |
uint32_t | get_rand_32 (void) |
Get 32-bit random number. More... | |
Random Number Generator API.
This module generates random numbers at runtime utilizing a number of possible entropy sources and uses those sources to modify the state of a 128-bit 'Pseudo Random Number Generator' implemented in software.
The random numbers (32 to 128 bit) to be supplied are read from the PRNG which is used to help provide a large number space.
The following (multiple) sources of entropy are available (of varying quality), each enabled by a #define:
With default settings, the seed generation takes approximately 1 millisecond while subsequent random numbers generally take between 10 and 20 microseconds to generate.
pico_rand methods may be safely called from either core or from an IRQ, but be careful in the latter case as the calls may block for a number of microseconds waiting on more entropy.
void get_rand_128 | ( | rng_128_t * | rand128 | ) |
Get 128-bit random number.
This method may be safely called from either core or from an IRQ, but be careful in the latter case as the call may block for a number of microseconds waiting on more entropy.
rand128 | Pointer to storage to accept a 128-bit random number |
uint32_t get_rand_32 | ( | void | ) |
Get 32-bit random number.
This method may be safely called from either core or from an IRQ, but be careful in the latter case as the call may block for a number of microseconds waiting on more entropy.
uint64_t get_rand_64 | ( | void | ) |
Get 64-bit random number.
This method may be safely called from either core or from an IRQ, but be careful in the latter case as the call may block for a number of microseconds waiting on more entropy.