Bluenet  5.7.0
Bluenet, firmware for nRF52 smart home devices
Loading...
Searching...
No Matches
RandomGenerator Class Reference

Crownstones pseudo random number generator wrapper. More...

#include <cs_RandomGenerator.h>

Collaboration diagram for RandomGenerator:

Public Member Functions

 RandomGenerator (uint32_t seed)
 The given seed need not be very high quality. More...
 
uint32_t rand ()
 Generates a new random number and updates the internal state. More...
 
uint32_t operator() ()
 

Private Attributes

Msws::State _state
 

Detailed Description

Crownstones pseudo random number generator wrapper.

Usefull for generating sequences of pseudo random numbers that are identical across devices in the mesh.

Constructor & Destructor Documentation

◆ RandomGenerator()

RandomGenerator::RandomGenerator ( uint32_t  seed)
inline

The given seed need not be very high quality.

The constructor will ensure that the internal state is set up to acceptable values, deterministically generated from the given seed parameter.

Member Function Documentation

◆ operator()()

uint32_t RandomGenerator::operator() ( )
inline

◆ rand()

uint32_t RandomGenerator::rand ( )
inline

Generates a new random number and updates the internal state.

Member Data Documentation

◆ _state

Msws::State RandomGenerator::_state
private

The documentation for this class was generated from the following file: