Class daisy::Random¶
True Random Number Generator access.More...
#include <rng.h>
Public Functions¶
Type | Name |
---|---|
Random () |
|
~Random () |
Public Static Functions¶
Type | Name |
---|---|
void | DeInit () |
float | GetFloat (float min=0.f, float max=1.f) |
uint32_t | GetValue () |
void | Init () |
bool | IsReady () |
Detailed Description¶
Author:
shensley
Provides static access to the built-in True Random Number Generator
Public Functions Documentation¶
function Random¶
function ~Random¶
Public Static Functions Documentation¶
function DeInit¶
Deinitializes the Peripheral
function GetFloat¶
Returns a floating point value between the specified minimum and maximum. Calls GetValue() internally.
Parameters:
min
the minimum value to return, defaults to 0.fmax
the maximum value to return, defaults to 1.f
function GetValue¶
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.
Returns:
a 32-bit random number
function Init¶
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.
function IsReady¶
Checks the peripheral to see if a new value is ready
Returns:
true if conditioning has finished and a new value can be read
The documentation for this class was generated from the following file external-docs/libDaisy/src/per/rng.h