ADS
Algorithms and Data Structures
Loading...
Searching...
No Matches
ADS::LinearCongruentialT< a, c, m > Class Template Reference

the generator \( X_{n+1} = ( a X_n + c ) \bmod m \) of LinearCongruential with \( a , c , m \) fixed at compile time, \( m = 0 \) meaning \( 2^{64} \): a UniformRandomBitGenerator, as min() and max() are constant More...

#include <ADS/numeric/RandomNumbers.h>

Public types

using result_type = std::uint64_t
 the type of the numbers

Public member functions

constexpr LinearCongruentialT (std::uint64_t seed=1)
 the generator from \( X_0 = \mathit{seed} \)
constexpr std::uint64_t operator() (void)
 the next number, \( X_{n+1} = ( a X_n + c ) \bmod m \)
bool operator== (const LinearCongruentialT &) const =default
 whether the two generators are in the same state

Static public member functions

static constexpr std::uint64_t min (void)
 the least number, 1 if \( c = 0 \), 0 otherwise
static constexpr std::uint64_t max (void)
 the largest number, \( m - 1 \)

Detailed description

template<std::uint64_t a, std::uint64_t c, std::uint64_t m>
class ADS::LinearCongruentialT< a, c, m >

the generator \( X_{n+1} = ( a X_n + c ) \bmod m \) of LinearCongruential with \( a , c , m \) fixed at compile time, \( m = 0 \) meaning \( 2^{64} \): a UniformRandomBitGenerator, as min() and max() are constant

Member typedef documentation

◆ result_type

template<std::uint64_t a, std::uint64_t c, std::uint64_t m>
using ADS::LinearCongruentialT< a, c, m >::result_type = std::uint64_t

the type of the numbers

Constructor and destructor documentation

◆ LinearCongruentialT()

template<std::uint64_t a, std::uint64_t c, std::uint64_t m>
ADS::LinearCongruentialT< a, c, m >::LinearCongruentialT ( std::uint64_t seed = 1)
explicitconstexpr

the generator from \( X_0 = \mathit{seed} \)

Precondition
\( m = 0 \) or \( \mathit{seed} < m \)

Member function documentation

◆ max()

template<std::uint64_t a, std::uint64_t c, std::uint64_t m>
constexpr std::uint64_t ADS::LinearCongruentialT< a, c, m >::max ( void )
inlinestaticconstexpr

the largest number, \( m - 1 \)

◆ min()

template<std::uint64_t a, std::uint64_t c, std::uint64_t m>
constexpr std::uint64_t ADS::LinearCongruentialT< a, c, m >::min ( void )
inlinestaticconstexpr

the least number, 1 if \( c = 0 \), 0 otherwise

◆ operator()()

template<std::uint64_t a, std::uint64_t c, std::uint64_t m>
std::uint64_t ADS::LinearCongruentialT< a, c, m >::operator() ( void )
constexpr

the next number, \( X_{n+1} = ( a X_n + c ) \bmod m \)

◆ operator==()

template<std::uint64_t a, std::uint64_t c, std::uint64_t m>
bool ADS::LinearCongruentialT< a, c, m >::operator== ( const LinearCongruentialT< a, c, m > & ) const
default

whether the two generators are in the same state


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