daisy::Random¶
True Random Number Generator access. More...
#include <rng.h>
Public Functions¶
Name | |
---|---|
Random() | |
~Random() | |
void | Init() |
void | DeInit() |
uint32_t | GetValue() |
float | GetFloat(float min =0.f, float max =1.f) |
bool | IsReady() |
Detailed Description¶
True Random Number Generator access.
Author: shensley
Provides static access to the built-in True Random Number Generator
Public Functions Documentation¶
function Random¶
function ~Random¶
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 DeInit¶
Deinitializes the Peripheral
function GetValue¶
Return: a 32-bit random number
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.
function GetFloat¶
Parameters:
- min the minimum value to return, defaults to 0.f
- max the maximum value to return, defaults to 1.f
Returns a floating point value between the specified minimum and maximum. Calls GetValue() internally.
function IsReady¶
Return: true if conditioning has finished and a new value can be read
Checks the peripheral to see if a new value is ready
---¶
Updated on 2024-01-03 at 19:41:01 +0000