#include <lib_math.h>
Linear congruential random value generator. The class will always produce the same output if the initialization seed was matching.
Public Member Functions | |
LinearCongruentialRandom () | |
void | Init (UInt32 seed) |
FLOAT | Get01 () |
FLOAT | Get11 () |
UInt32 | GetUInt32 () |
UInt32 | GetSeed () const |
void | SetSeed (UInt32 seed) |
Private Attributes | |
UInt32 | _seed |
void Init | ( | UInt32 | seed | ) |
Initialize the random class with a custom seed value. The seed initially is advanced to avoid clustering close to 0 for typical user-adjusted values.
[in] | seed | Seed value. |
FLOAT Get01 | ( | ) |
Returns the next random value in the range of [0..1].
FLOAT Get11 | ( | void | ) |
Returns the next random value in the range of [-1..1].
UInt32 GetUInt32 | ( | ) |
Returns the next 32-bit random value.
UInt32 GetSeed | ( | void | ) | const |
Returns the current seed value.
|
private |