Pseudo-Random number generator.
- Note
- This generator uses Xorshift (see https://en.wikipedia.org/wiki/Xorshift)
#include <srl_math.hpp>
|
| Random () |
| Construct a new pseudo-random number generator.
|
|
| Random (uint32_t seed) |
| Construct a new pseudo-random number generator.
|
|
| ~Random () |
| Destroy the pseudo-random number generator object.
|
|
uint32_t | GetNumber () |
| Get next pseudo-random number.
|
|
int32_t | GetNumber (int32_t from, int32_t to) |
| Get next pseudo-random number.
|
|
◆ Random()
SRL::Math::Random::Random |
( |
uint32_t | seed | ) |
|
|
inline |
Construct a new pseudo-random number generator.
- Parameters
-
◆ GetNumber() [1/2]
uint32_t SRL::Math::Random::GetNumber |
( |
| ) |
|
|
inline |
Get next pseudo-random number.
- Returns
- Generated number in a full range
◆ GetNumber() [2/2]
int32_t SRL::Math::Random::GetNumber |
( |
int32_t | from, |
|
|
int32_t | to ) |
|
inline |
Get next pseudo-random number.
- Parameters
-
from | Inclusive start of the range |
to | Inclusive end of the range |
- Returns
- Generated number in a range