Main Page Modules Namespaces C++ Classes Compound List File List Index
TNL::Random Namespace Reference

TNL::Random Namespace Reference


Detailed Description

The Random namespace is an interface to a cryptographically secure pseudo random number generator (PRNG).

Internally the Random namespace uses the Yarrow PRNG algorithm.


Functions

void addEntropy (const U8 *randomData, U32 dataLen)
 Adds random "seed" data to the random number generator.

void read (U8 *outBuffer, U32 randomLen)
 Reads random byte data from the random number generator.

U32 readI ()
 Reads a 0...U32_MAX random number from the random number generator.

U32 readI (U32 rangeStart, U32 rangeEnd)
 Reads a random number between rangeStart and rangeEnd inclusive from the random number generator.

F32 readF ()
 Reads a floating point value from 0 to 1 from the random number generator.

bool readB ()
 Returns a single random bit.

void * getState ()
 Returns an opaque pointer to the random number generator's internal state for use in certain encryption functions.


Function Documentation

void addEntropy const U8 randomData,
U32  dataLen
 

Adds random "seed" data to the random number generator.

void read U8 outBuffer,
U32  randomLen
 

Reads random byte data from the random number generator.

U32 readI  ) 
 

Reads a 0...U32_MAX random number from the random number generator.

U32 readI U32  rangeStart,
U32  rangeEnd
 

Reads a random number between rangeStart and rangeEnd inclusive from the random number generator.

F32 readF  ) 
 

Reads a floating point value from 0 to 1 from the random number generator.

bool readB  ) 
 

Returns a single random bit.

void* getState  ) 
 

Returns an opaque pointer to the random number generator's internal state for use in certain encryption functions.