Random number generator using Mersenne Twist (MT19937) More...
Public Member Functions | |
const Burger::StaticRTTI * | get_StaticRTTI (void) const noexcept override |
Get the description to the class. | |
RandomMersenneTwist (uint32_t uNewSeed=5489U) noexcept | |
Static constructor. | |
void | set_seed (uint32_t uNewSeed) noexcept override |
Seed the random number generator. | |
uint32_t | get (void) noexcept override |
Return a 32 bit pseudo random number. | |
Public Member Functions inherited from Burger::RandomBase | |
uint32_t | get_seed (void) const noexcept |
Return the random number seed. | |
void | random_seed (void) noexcept |
Seed with a random value. | |
uint32_t | get_uint32 (uint32_t uRange) noexcept |
Return a 32 bit random number. | |
uint32_t | get_dice (uint32_t uDiceCount, uint32_t uDiceSize) noexcept |
Return a dice roll. | |
int32_t | get_int32 (uint32_t uRange) noexcept |
Return a signed value in a specific range. | |
float | get_float (void) noexcept |
Return a float from 0.0f to 0.99999f. | |
float | get_float (float fRange) noexcept |
Return a float from 0.0f to fRange. | |
float | get_symmetric_float (void) noexcept |
Return a float from -.0.99999f to 0.99999f. | |
float | get_symmetric_float (float fRange) noexcept |
Return a float from -fRange to fRange. | |
double | get_double (void) noexcept |
Return a double from 0.0 to 0.999999999. | |
Public Member Functions inherited from Burger::Base | |
const char * | get_class_name (void) const noexcept |
Get the name of the class. | |
virtual | ~Base () noexcept=default |
Destructor. | |
Static Public Member Functions | |
static RandomMersenneTwist * | New (uint32_t uNewSeed=0) noexcept |
Create a new instance of RandomMersenneTwist. | |
Static Public Attributes | |
static const Burger::StaticRTTI | g_StaticRTTI |
The global description of the class. | |
Static Public Attributes inherited from Burger::RandomBase | |
static const Burger::StaticRTTI | g_StaticRTTI |
The global description of the class. | |
Static Public Attributes inherited from Burger::Base | |
static const Burger::StaticRTTI | g_StaticRTTI |
The global description of the class. | |
Protected Attributes | |
uint32_t | m_Array [kElements] |
Array of seed values (Polynomial) | |
uint32_t | m_uIndex |
First lookup index. | |
Protected Attributes inherited from Burger::RandomBase | |
uint32_t | m_uSeed |
Random number seed. | |
Static Protected Attributes | |
static const uint_t | kElements = 624 |
Number of elements in the polynomial array. | |
static const uint_t | kTapIndex = 397 |
Tap index into the polynomial array. | |
Random number generator using Mersenne Twist (MT19937)
This class will create random numbers that are spread evenly across a 32 bit range.
https://en.wikipedia.org/wiki/Mersenne_Twister
|
noexcept |
Static constructor.
Initialize the random number generator with a call to set_seed(uint32_t).
uNewSeed | New seed value |
|
overridevirtualnoexcept |
Return a 32 bit pseudo random number.
Get a pseudo random number using the current algorithm. Return a 32 bit unsigned value.
Implements Burger::RandomBase.
|
overridevirtualnoexcept |
Get the description to the class.
This virtual function will pull the pointer to the StaticRTTI instance that has the name of the class. Due to it being virtual, it will be the name of the most derived class.
Reimplemented from Burger::RandomBase.
|
staticnoexcept |
Create a new instance of RandomMersenneTwist.
Create a new random number generator instance using the Burgerlib memory manager.
uNewSeed | Seed value for the random number generator |
|
overridevirtualnoexcept |
Seed the random number generator.
Set the random number generator to a specific seed. This allows altering the random number flow in a controlled manner.
uNewSeed | 32 bit seed value. |
Implements Burger::RandomBase.
|
static |
The global description of the class.
This record contains the name of this class and a reference to the parent
|
staticprotected |
Number of elements in the polynomial array.
|
staticprotected |
Tap index into the polynomial array.
|
protected |
Array of seed values (Polynomial)
|
protected |
First lookup index.