RNG based on Xoroshiro128+.
More...
#include <Random.h>
|
| Random ()=delete |
| Free the pointed object. More...
|
|
| Random (std::uint64_t seed=0) |
| Initialize the random number generator with a seed. More...
|
|
void | seedrandom (std::uint64_t s) |
| Initialize state of xoroshiro128+ by transforming the seed with the splitmix64 algorithm. More...
|
|
std::uint32_t | randfix () |
| Check that the random number will be generated in a correct range, then generate it. More...
|
|
std::uint64_t | randuint64 () |
| Generate raw random number. More...
|
|
std::uint64_t | randuint64 (const std::uint64_t max) |
| Generate random number between [0, max-1] using uniform_int_distribution. More...
|
|
result_type | operator() () |
| Generate a raw random number, part of UniformRandomBitGenerator interface. More...
|
|
|
std::uint64_t | gen (void) |
| Generate random generated number with Xoroshiro128+. More...
|
|
RNG based on Xoroshiro128+.
- Copyright
- GNU General Public License
-
Part of Leela Zero software
- Author
- Gian-Carlo Pascutto
◆ result_type
◆ Random() [1/2]
Utils::Random::Random |
( |
| ) |
|
|
delete |
◆ Random() [2/2]
Utils::Random::Random |
( |
std::uint64_t |
seed = 0 | ) |
|
Initialize the random number generator with a seed.
- Parameters
-
seed | The value of the seed |
◆ gen()
Utils::Random::gen |
( |
void |
| ) |
|
|
private |
Generate random generated number with Xoroshiro128+.
- Returns
- Random generated number
◆ get_Rng()
Utils::Random::get_Rng |
( |
void |
| ) |
|
|
static |
Get a copy of the current thread.
- Returns
- A thread local RNG
◆ max()
Max integer value, part of UniformRandomBitGenerator interface.
- Returns
- Highest uint64_t value
◆ min()
Min integer value, part of UniformRandomBitGenerator interface.
- Returns
- Lowest uint64_t value
◆ operator()()
Utils::Random::operator() |
( |
| ) |
|
|
inline |
Generate a raw random number, part of UniformRandomBitGenerator interface.
- Returns
- The random generated number
◆ randfix()
std::uint32_t Utils::Random::randfix< 2 > |
( |
| ) |
|
|
inline |
Check that the random number will be generated in a correct range, then generate it.
- Returns
- Random generated number between [0, max-1]
◆ randuint64() [1/2]
Utils::Random::randuint64 |
( |
| ) |
|
Generate raw random number.
- Returns
- The random generated number
◆ randuint64() [2/2]
Utils::Random::randuint64 |
( |
const std::uint64_t |
max | ) |
|
Generate random number between [0, max-1] using uniform_int_distribution.
- Returns
- The random generated number
◆ seedrandom()
Utils::Random::seedrandom |
( |
std::uint64_t |
s | ) |
|
Initialize state of xoroshiro128+ by transforming the seed with the splitmix64 algorithm.
- Parameters
-
◆ m_s
std::uint64_t Utils::Random::m_s[2] |
|
private |
Array used to compute random numbers
The documentation for this class was generated from the following files: