libstdc++
std::linear_congruential_engine< _UIntType, __a, __c, __m > Class Template Reference

Public Types

typedef _UIntType result_type
 

Public Member Functions

 linear_congruential_engine ()
 
template<typename _Sseq , typename = _If_seed_seq<_Sseq>>
 linear_congruential_engine (_Sseq &__q)
 
 linear_congruential_engine (result_type __s)
 
void discard (unsigned long long __z)
 
result_type operator() ()
 
template<typename _Sseq >
_If_seed_seq< _Sseq > seed (_Sseq &__q)
 
template<typename _Sseq >
auto seed (_Sseq &__q) -> _If_seed_seq< _Sseq >
 
void seed (result_type __s=default_seed)
 

Static Public Member Functions

static constexpr result_type max ()
 
static constexpr result_type min ()
 

Static Public Attributes

static constexpr result_type default_seed
 
static constexpr result_type increment
 
static constexpr result_type modulus
 
static constexpr result_type multiplier
 

Friends

template<typename _UIntType1 , _UIntType1 __a1, _UIntType1 __c1, _UIntType1 __m1, typename _CharT , typename _Traits >
std::basic_ostream< _CharT, _Traits > & operator<< (std::basic_ostream< _CharT, _Traits > &__os, const std::linear_congruential_engine< _UIntType1, __a1, __c1, __m1 > &__lcr)
 
bool operator== (const linear_congruential_engine &__lhs, const linear_congruential_engine &__rhs)
 
template<typename _UIntType1 , _UIntType1 __a1, _UIntType1 __c1, _UIntType1 __m1, typename _CharT , typename _Traits >
std::basic_istream< _CharT, _Traits > & operator>> (std::basic_istream< _CharT, _Traits > &__is, std::linear_congruential_engine< _UIntType1, __a1, __c1, __m1 > &__lcr)
 

Detailed Description

template<typename _UIntType, _UIntType __a, _UIntType __c, _UIntType __m>
class std::linear_congruential_engine< _UIntType, __a, __c, __m >

A model of a linear congruential random number generator.

A random number generator that produces pseudorandom numbers via linear function:

\[ x_{i+1}\leftarrow(ax_{i} + c) \bmod m \]

The template parameter _UIntType must be an unsigned integral type large enough to store values up to (__m-1). If the template parameter __m is 0, the modulus __m used is std::numeric_limits<_UIntType>::max() plus 1. Otherwise, the template parameters __a and __c must be less than __m.

The size of the state is $1$.

Definition at line 255 of file random.h.

Member Function Documentation

◆ seed()

template<typename _UIntType , _UIntType __a, _UIntType __c, _UIntType __m>
template<typename _Sseq >
auto std::linear_congruential_engine< _UIntType, __a, __c, __m >::seed ( _Sseq &  __q) -> _If_seed_seq<_Sseq>

Seeds the LCR engine with a value generated by __q.

Definition at line 132 of file bits/random.tcc.

References std::__lg().


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