FreeNOS
|
Produces random integers using the Linear congruential generator algorithm. More...
#include <Randomizer.h>
Public Member Functions | |
void | seed (const ulong value) |
Set a value as the current state. More... | |
ulong | next () |
Get next randomized value. More... | |
Static Private Attributes | |
static const ulong | Modulus = 1 << 31 |
Used in modulus operation of calculated value. More... | |
static const ulong | Multiplier = 1103515245 |
Used to multiply calculated value. More... | |
static const ulong | Constant = 12345 |
Added to calculated value. More... | |
static ulong | m_value = 1 |
Current randomizer value. More... | |
Produces random integers using the Linear congruential generator algorithm.
Definition at line 36 of file Randomizer.h.
ulong Randomizer::next | ( | ) |
Get next randomized value.
Definition at line 27 of file Randomizer.cpp.
References Constant, m_value, Modulus, and Multiplier.
Referenced by random(), and UDPSocket::write().
void Randomizer::seed | ( | const ulong | value | ) |
Set a value as the current state.
value | Value to set |
Definition at line 22 of file Randomizer.cpp.
References m_value.
Referenced by setupRandomizer(), and srandom().
|
staticprivate |
|
staticprivate |
Current randomizer value.
Definition at line 68 of file Randomizer.h.
|
staticprivate |
Used in modulus operation of calculated value.
Definition at line 41 of file Randomizer.h.
Referenced by next().
|
staticprivate |
Used to multiply calculated value.
Definition at line 44 of file Randomizer.h.
Referenced by next().