|
Aleph-w 7.10.0
A C++ Library for Data Structures and Algorithms
|
SplitMix64: a random number generator whose state is a word of 64 bits. More...
#include <ah-random.H>
Public Types | |
| using | result_type = std::uint64_t |
| The type of the numbers of operator()(). | |
Public Member Functions | |
| constexpr | SplitMix64_Rng () noexcept |
| A generator with the default seed. | |
| constexpr | SplitMix64_Rng (const std::uint64_t s) noexcept |
| A generator with a seed. | |
| constexpr void | seed (const std::uint64_t s) noexcept |
| Seeds again. | |
| constexpr result_type | operator() () noexcept |
| The next number, in [min(), max()]. | |
Static Public Member Functions | |
| static constexpr result_type | min () noexcept |
| The least number of operator()(). | |
| static constexpr result_type | max () noexcept |
| The greatest number of operator()(): 2^64 - 1. | |
| static constexpr std::uint64_t | mix (std::uint64_t z) noexcept |
| The number of a state: a bijection of the 64-bit integers that scrambles its bits. | |
Static Public Attributes | |
| static constexpr std::uint64_t | default_seed = 0 |
| The seed of a generator that is given none. | |
| static constexpr std::uint64_t | increment = 0x9e3779b97f4a7c15ULL |
| What the state advances for each number: 2^64 divided by the golden ratio, as an odd integer. | |
Private Attributes | |
| std::uint64_t | state |
Friends | |
| constexpr bool | operator== (const SplitMix64_Rng &a, const SplitMix64_Rng &b) noexcept |
| Whether two generators give the same numbers from now on. | |
SplitMix64: a random number generator whose state is a word of 64 bits.
It is the generator of Steele, Lea and Flood ("Fast splittable
pseudorandom number generators", OOPSLA 2014) with a fixed increment, as the splitmix64.c of Vigna and the SplittableRandom of Java built with a seed: the state advances by an odd constant, so that it goes through its 2^64 values before it repeats, and each number is the state scrambled by a bijection. For each seed, the numbers are those of these implementations, on every platform.
It is the generator of a Random_Source that is not asked for the Mersenne Twister: it takes a word, where a Gsl_Compatible_Rng takes about 2500 bytes, and seeding it is storing that word.
It satisfies std::uniform_random_bit_generator, and every member is constexpr.
Definition at line 641 of file ah-random.H.
| using Aleph::SplitMix64_Rng::result_type = std::uint64_t |
The type of the numbers of operator()().
Definition at line 647 of file ah-random.H.
|
inlineconstexprnoexcept |
A generator with the default seed.
Definition at line 676 of file ah-random.H.
|
inlineexplicitconstexprnoexcept |
A generator with a seed.
| [in] | s | The seed: the state before the first number. |
Definition at line 682 of file ah-random.H.
|
inlinestaticconstexprnoexcept |
The greatest number of operator()(): 2^64 - 1.
Definition at line 660 of file ah-random.H.
Referenced by TEST().
|
inlinestaticconstexprnoexcept |
|
inlinestaticconstexprnoexcept |
The number of a state: a bijection of the 64-bit integers that scrambles its bits.
| [in] | z | The state. |
Definition at line 668 of file ah-random.H.
Referenced by Aleph::random_detail::entropy_of_the_run(), operator()(), Aleph::random_detail::seed_of_its_own(), and TEST().
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
Seeds again.
| [in] | s | The seed: the state before the next number. |
Definition at line 688 of file ah-random.H.
References state.
Referenced by Aleph::Random_Source::seed(), TEST(), and TEST().
|
friend |
Whether two generators give the same numbers from now on.
| [in] | a | A generator. |
| [in] | b | Another one. |
Definition at line 702 of file ah-random.H.
|
staticconstexpr |
The seed of a generator that is given none.
Definition at line 650 of file ah-random.H.
Referenced by TEST().
|
staticconstexpr |
What the state advances for each number: 2^64 divided by the golden ratio, as an odd integer.
Definition at line 654 of file ah-random.H.
Referenced by Aleph::random_detail::entropy_of_the_run(), operator()(), Aleph::random_detail::seed_of_its_own(), TEST(), TEST(), TEST(), and TEST().
|
private |
Definition at line 643 of file ah-random.H.
Referenced by operator()(), and seed().