ADS
Algorithms and Data Structures
Loading...
Searching...
No Matches
ADS::Xoshiro256T< StarStar > Class Template Reference

xoshiro256++ (or xoshiro256** if StarStar), a std::uniform_random_bit_generator of 64 bits More...

#include <ADS/numeric/RandomGenerators.h>

Public types

using result_type = std::uint64_t

Public member functions

constexpr Xoshiro256T (std::uint64_t seed=1)
 < the type of the numbers
constexpr std::uint64_t operator() (void)
 the next number
constexpr void jump (void)
 advances by \( 2^{128} \) steps, a stream of \( 2^{128} \) numbers apart
bool operator== (const Xoshiro256T &) const =default
 true if the two states are equal

Static public member functions

static constexpr std::uint64_t min (void)
 the least number, 0
static constexpr std::uint64_t max (void)
 the largest number, \( 2^{64} - 1 \)

Detailed description

template<bool StarStar>
class ADS::Xoshiro256T< StarStar >

xoshiro256++ (or xoshiro256** if StarStar), a std::uniform_random_bit_generator of 64 bits

Member typedef documentation

◆ result_type

template<bool StarStar>
using ADS::Xoshiro256T< StarStar >::result_type = std::uint64_t

Constructor and destructor documentation

◆ Xoshiro256T()

template<bool StarStar>
ADS::Xoshiro256T< StarStar >::Xoshiro256T ( std::uint64_t seed = 1)
explicitconstexpr

< the type of the numbers

the state from the seed by SplitMix64, never all zero

Member function documentation

◆ jump()

template<bool StarStar>
void ADS::Xoshiro256T< StarStar >::jump ( void )
constexpr

advances by \( 2^{128} \) steps, a stream of \( 2^{128} \) numbers apart

In pseudocode (Blackman and Vigna, beyond the book), \( J \) the 256 bits of the polynomial of the jump:

\[\class{pseudocode}{\begin{array}{r@{\quad}l} 1 & \textbf{procedure}\ \mathrm{jump}() \cr 2 & \quad a \gets 0 \cr 3 & \quad \textbf{for}\ b \gets 0\ \textbf{to}\ 255\ \textbf{do} \cr 4 & \qquad \textbf{if}\ J_b = 1\ \textbf{then}\ a \gets a \oplus s \cr 5 & \qquad \mathrm{next}() \cr 6 & \quad s \gets a \end{array}} \]

◆ max()

template<bool StarStar>
constexpr std::uint64_t ADS::Xoshiro256T< StarStar >::max ( void )
inlinestaticconstexpr

the largest number, \( 2^{64} - 1 \)

◆ min()

template<bool StarStar>
constexpr std::uint64_t ADS::Xoshiro256T< StarStar >::min ( void )
inlinestaticconstexpr

the least number, 0

◆ operator()()

template<bool StarStar>
std::uint64_t ADS::Xoshiro256T< StarStar >::operator() ( void )
constexpr

the next number

In pseudocode (Blackman and Vigna, beyond the book), the output from the state before the step:

\[\class{pseudocode}{\begin{array}{r@{\quad}l} 1 & \textbf{function}\ \mathrm{next}() \cr 2 & \quad r \gets \mathrm{rotl}( s_0 + s_3 , 23 ) + s_0\quad \triangleright\ \mathrm{rotl}( 5 s_1 , 7 ) \cdot 9 \text{ for **} \cr 3 & \quad t \gets s_1 \ll 17 \cr 4 & \quad s_2 \gets s_2 \oplus s_0;\ s_3 \gets s_3 \oplus s_1;\ s_1 \gets s_1 \oplus s_2;\ s_0 \gets s_0 \oplus s_3 \cr 5 & \quad s_2 \gets s_2 \oplus t;\ s_3 \gets \mathrm{rotl}( s_3 , 45 ) \cr 6 & \quad \textbf{return}\ r \end{array}} \]

◆ operator==()

template<bool StarStar>
bool ADS::Xoshiro256T< StarStar >::operator== ( const Xoshiro256T< StarStar > & ) const
default

true if the two states are equal


The documentation for this class was generated from the following file: