True Random Number Generator access. More...
True Random Number Generator access.
Provides static access to the built-in True Random Number Generator
#include <rng.h>
Public Member Functions | |
Random () | |
~Random () | |
Static Public Member Functions | |
static void | Init () |
static void | DeInit () |
static uint32_t | GetValue () |
static float | GetFloat (float min=0.f, float max=1.f) |
static bool | IsReady () |
|
inline |
|
inline |
Returns a floating point value between the specified minimum and maximum. Calls GetValue() internally.
min | the minimum value to return, defaults to 0.f |
max | the maximum value to return, defaults to 1.f |
Returns a randomly generated 32-bit number This is done by polling the peripheral, and can block for up to 100ms.
To avoid blocking issues, the IsReady function can be used to check if a value is ready before calling this function.
If there is an issue with the peripheral, or a timeout occurs the return value will be 0.
Initializes the Peripheral
This is called from System::Init, so the GetValue, and GetFloat functions can be used without the application needing to manually initialize the RNG.
Checks the peripheral to see if a new value is ready