xso::generator
— Predefined Type Aliases
Introduction
Our xoshiro/xoroshiro implementations depend on up to 10 template parameters:
- The unsigned word type used to store the state is also the generator’s output type.
- The number of words used to store the state. More words mean more state.
- Up to three parameters are labelled \(A\), \(B\), and \(C\) which determines how the state is advanced.
- Up to three further parameters are labelled \(R\), \(S\), and \(T\) which determines how the state is scrambled to produce the required single word of output.
- Up to two indices that determine the words of the state taking part in the output function.
The code in xoshiro.h
covers all possible cases, but typing many parameters is a pain. Moreover, while we can instantiate any generator in the family, only a limited number have been properly vetted for suitability as “good.”
Therefore, we provide a few type aliases for the generators you should use in most cases.
Recommended Generators
The following type aliases cover the recommended defaults for 32-bit and 64-bit outputs:
Type Alias | Output Bits | State Bits | Synonym For |
---|---|---|---|
xso::rng |
64 | 256 | xso::rng64 |
xso::rng64 |
64 | 256 | xso::xoshiro_4x64_star_star |
xso::rng32 |
32 | 128 | xso::xoshiro_4x32_star_star |
The overall “default” xso::rng
is the same thing as xso::rng64
.
The 32-bit version has 128 bits of state in four 32-bit words, while the 64-bit version has 256 bits of state stored in four 64-bit words.
These generators pick specific A
, B
, and C
parameters for the state advance method and specific R
, S
and T
parameters for the output/scrambler function. The choices are shown in rows 11 and 14 of the table below.
Analyzed Generators
Beyond the recommended and simplest type aliases above, we also provide rationally named type aliases for 17 variants, which are analyzed in some detail in this original paper.
# | Type Alias | Output Bits | State Bits | State State | Output Function |
---|---|---|---|---|---|
1 | xoroshiro_2x32_star |
32 | 64 | xoroshiro<26,9,13> |
star<0x9E3779BB,0> |
2 | xoroshiro_2x32_star_star |
32 | 64 | xoroshiro<26,9,13> |
star_star<0x9E3779BBu,5,5,0> |
3 | xoroshiro_2x64_plus |
64 | 128 | xoroshiro<24,16,37> |
plus<0,1> |
4 | xoroshiro_2x64_plus_plus |
64 | 128 | xoroshiro<49,21,28> |
plus_plus<17,0,1> |
5 | xoroshiro_2x64_star_star |
64 | 128 | xoroshiro<24,16,37> |
star_star<5,7,9,0> |
6 | xoroshiro_16x64_star |
64 | 1024 | xoroshiro<25,27,36> |
star<0x9e3779b97f4a7c13,0> |
7 | xoroshiro_16x64_star_star |
64 | 1024 | xoroshiro<25,27,36> |
star_star<5,7,9,0> |
8 | xoroshiro_16x64_plus_plus |
64 | 1024 | xoroshiro<25,27,36> |
plus_plus<23,15,0> |
9 | xoshiro_4x32_plus |
32 | 128 | xoshiro<9,11> |
plus<0,3> |
10 | xoshiro_4x32_plus_plus |
32 | 128 | xoshiro<9,11> |
plus_plus<7,0,3> |
11 | xoshiro_4x32_star_star |
32 | 128 | xoshiro<9,11> |
plus_plus<7,0,3> |
12 | xoshiro_4x64_plus |
64 | 256 | xoshiro<17,45> |
plus<0,3> |
13 | xoshiro_4x64_plus_plus |
64 | 256 | xoshiro<17,45> |
plus_plus<23,0,3> |
14 | xoshiro_4x64_star_star |
64 | 256 | xoshiro<17,45> |
star_star<5,7,9,1> |
15 | xoshiro_8x64_plus |
64 | 512 | xoshiro<11,21> |
plus<2,0> |
16 | xoshiro_8x64_plus_plus |
64 | 512 | xoshiro<11,21> |
plus_plus<17,2,0> |
17 | xoshiro_8x64_star_star |
64 | 512 | xoshiro<11,21> |
star_star<5,7,9,1> |
The naming convention should be fairly obvious — xoshiro
or xoroshiro
followed by the number of words of state and the size of those words, followed by some information about the type of output function that is used. The specific choices for the A
, B
, C
, R
, S
, and T
parameters are shown in the final two columns of the table.
All the type aliases, engines, and output functions above are actually in the xso namespace — that has been dropped in the table for the sake of brevity. ### See Also
|