A simple random number generator. More...
Public Member Functions | |
const Burger::StaticRTTI * | get_StaticRTTI (void) const noexcept override |
Get the description to the class. | |
Random (uint32_t uNewSeed=728056387U) 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 | |
const Burger::StaticRTTI * | get_StaticRTTI (void) const noexcept override |
Get the description to the class. | |
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 Random * | New (uint32_t uNewSeed=0) noexcept |
Create a new instance of Random. | |
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 [17] |
Array of seed values (Polynomial) | |
uint32_t | m_uState |
Last random number generated. | |
uint32_t | m_uIndex |
First lookup index. | |
Protected Attributes inherited from Burger::RandomBase | |
uint32_t | m_uSeed |
Random number seed. | |
A simple random number generator.
This class will create random numbers that are spread evenly across a 32 bit range.
This algorithm uses a simple table and iterates over it using an index and bit rotation.
|
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::Base.
|
staticnoexcept |
Create a new instance of Random.
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
|
protected |
Array of seed values (Polynomial)
|
protected |
First lookup index.
|
protected |
Last random number generated.