|
Celeritas 0.7.0-dev.242+develop.62c3034b
|
Generate random data using the XORWOW algorithm. More...
#include <XorwowRngEngine.hh>
Public Types | |
Type aliases | |
| using | uint_t = XorwowUInt |
| using | result_type = uint_t |
| using | Initializer_t = XorwowRngInitializer |
| using | ParamsRef = NativeCRef< XorwowRngParamsData > |
| using | StateRef = NativeRef< XorwowRngStateData > |
Public Member Functions | |
| XorwowRngEngine (ParamsRef const ¶ms, StateRef const &state, TrackSlotId tid) | |
| Construct from state and persistent data. | |
| XorwowRngEngine & | operator= (Initializer_t const &) |
| Initialize the RNG engine. | |
| result_type | operator() () |
| Generate a 32-bit pseudorandom number using the 'xorwow' engine. | |
| void | discard (ull_int count) |
Advance the state count times. | |
Static Public Member Functions | |
| static constexpr result_type | min () |
| Lowest value potentially generated. | |
| static constexpr result_type | max () |
| Highest value potentially generated. | |
Generate random data using the XORWOW algorithm.
The XorwowRngEngine uses a C++11-like interface to generate random data using Marasglia's modified xorshift generator (marsaglia-xorshift-2003). The sampling of uniform floating point data is done with specializations to the GenerateCanonical class.
The resize function for XorwowRngStateData will fully randomize the state at initialization. Alternatively, the state can be initialized with a seed, subsequence, and offset.
Initialization moves the state ahead to the given subsequence (a subsequence has size \(2^{67}\)) and skips offset random numbers. It is recommended to initialize the state using a very different generator from the one being initialized to avoid correlations. Here, the 64-bit SplitMix64 generator is used for initialization (matsumoto-defects-2007).
For a description of the jump ahead method using the polynomial representation of the recurrence, see haramato-jump-2008.
The jump polynomials were precomputed using a python script. For a more detailed description of how to calculate the jump polynomials using Knuth's square-and-multiply algorithm in \( O(k^2 log d) \) time (where k is the number of bits in the state and d is the number of steps to skip ahead), see collins-rng-2008.