ADS
Algorithms and Data Structures
Loading...
Searching...
No Matches
ADS::WyRand Class Reference

< xoshiro256** More...

#include <ADS/numeric/RandomGenerators.h>

Public types

using result_type = std::uint64_t

Public member functions

constexpr WyRand (std::uint64_t seed=1)
 < the type of the numbers
constexpr std::uint64_t operator() (void)
 the next number
bool operator== (const WyRand &) 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

< xoshiro256**

wyrand, a std::uniform_random_bit_generator of 64 bits

Member typedef documentation

◆ result_type

using ADS::WyRand::result_type = std::uint64_t

Constructor and destructor documentation

◆ WyRand()

ADS::WyRand::WyRand ( std::uint64_t seed = 1)
inlineexplicitconstexpr

< the type of the numbers

the generator whose Weyl sequence starts at the seed

Member function documentation

◆ max()

constexpr std::uint64_t ADS::WyRand::max ( void )
inlinestaticconstexpr

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

◆ min()

constexpr std::uint64_t ADS::WyRand::min ( void )
inlinestaticconstexpr

the least number, 0

◆ operator()()

std::uint64_t ADS::WyRand::operator() ( void )
constexpr

the next number

In pseudocode (Wang Yi, beyond the book), \( c \) and \( c' \) two constants of 64 bits, \( c \) odd:

\[\class{pseudocode}{\begin{array}{r@{\quad}l} 1 & \textbf{function}\ \mathrm{next}() \cr 2 & \quad s \gets s + c \bmod 2^{64} \cr 3 & \quad ( h , l ) \gets \text{the high and the low word of } s ( s \oplus c' ) \cr 4 & \quad \textbf{return}\ h \oplus l \end{array}} \]

◆ operator==()

bool ADS::WyRand::operator== ( const WyRand & ) const
default

true if the two states are equal


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