.TH "std::linear_congruential_engine< _UIntType, __a, __c, __m >" 3cxx "libstdc++" \" -*- nroff -*- .ad l .nh .SH NAME std::linear_congruential_engine< _UIntType, __a, __c, __m > \- A model of a linear congruential random number generator\&. .SH SYNOPSIS .br .PP .PP \fC#include \fP .SS "Public Types" .in +1c .ti -1c .RI "\fBtypedef\fP _UIntType \fBresult_type\fP" .br .in -1c .SS "Public Member Functions" .in +1c .ti -1c .RI "\fBlinear_congruential_engine\fP ()" .br .RI "Constructs a linear_congruential_engine random number generator engine with seed 1\&. " .ti -1c .RI "template<\fBtypename\fP \fB_Sseq\fP , \fBtypename\fP = _If_seed_seq<_Sseq>> \fBlinear_congruential_engine\fP (\fB_Sseq\fP &__q)" .br .RI "Constructs a linear_congruential_engine random number generator engine seeded from the seed sequence \fC__q\fP\&. " .ti -1c .RI "\fBlinear_congruential_engine\fP (\fBresult_type\fP \fB__s\fP)" .br .RI "Constructs a linear_congruential_engine random number generator engine with seed \fC__s\fP\&. The default seed value is 1\&. " .ti -1c .RI "\fBvoid\fP \fBdiscard\fP (unsigned long long \fB__z\fP)" .br .RI "Discard a sequence of random numbers\&. " .ti -1c .RI "\fBresult_type\fP \fBoperator()\fP ()" .br .RI "Gets the next random number in the sequence\&. " .ti -1c .RI "template<\fBtypename\fP \fB_Sseq\fP > _If_seed_seq< \fB_Sseq\fP > \fBseed\fP (\fB_Sseq\fP &__q)" .br .RI "Reseeds the linear_congruential_engine random number generator engine sequence using values from the seed sequence \fC__q\fP\&. " .ti -1c .RI "template<\fBtypename\fP \fB_Sseq\fP > \fBauto\fP \fBseed\fP (\fB_Sseq\fP &__q) \-> _If_seed_seq< \fB_Sseq\fP >" .br .ti -1c .RI "\fBvoid\fP \fBseed\fP (\fBresult_type\fP \fB__s\fP=default_seed)" .br .RI "Reseeds the linear_congruential_engine random number generator engine sequence to the seed \fC__s\fP\&. " .in -1c .SS "Static Public Member Functions" .in +1c .ti -1c .RI "\fBstatic\fP \fBconstexpr\fP \fBresult_type\fP \fBmax\fP ()" .br .RI "Gets the largest possible value in the output range\&. " .ti -1c .RI "\fBstatic\fP \fBconstexpr\fP \fBresult_type\fP \fBmin\fP ()" .br .RI "Gets the smallest possible value in the output range\&. " .in -1c .SS "Static Public Attributes" .in +1c .ti -1c .RI "\fBstatic\fP \fBconstexpr\fP \fBresult_type\fP \fBdefault_seed\fP" .br .ti -1c .RI "\fBstatic\fP \fBconstexpr\fP \fBresult_type\fP \fBincrement\fP" .br .ti -1c .RI "\fBstatic\fP \fBconstexpr\fP \fBresult_type\fP \fBmodulus\fP" .br .ti -1c .RI "\fBstatic\fP \fBconstexpr\fP \fBresult_type\fP \fBmultiplier\fP" .br .in -1c .SS "Friends" .in +1c .ti -1c .RI "template<\fBtypename\fP \fB_UIntType1\fP , \fB_UIntType1\fP __a1, \fB_UIntType1\fP __c1, \fB_UIntType1\fP __m1, \fBtypename\fP _CharT , \fBtypename\fP _Traits > \fBstd::basic_ostream\fP< _CharT, _Traits > & \fBoperator<<\fP (\fBstd::basic_ostream\fP< _CharT, _Traits > &\fB__os\fP, \fBconst\fP \fBstd::linear_congruential_engine\fP< \fB_UIntType1\fP, __a1, __c1, \fB__m1\fP > &\fB__lcr\fP)" .br .RI "Writes the textual representation of the state x(i) of x to \fC__os\fP\&. " .ti -1c .RI "bool \fBoperator==\fP (\fBconst\fP \fBlinear_congruential_engine\fP &\fB__lhs\fP, \fBconst\fP \fBlinear_congruential_engine\fP &\fB__rhs\fP)" .br .RI "Compares two linear congruential random number generator objects of the same type for equality\&. " .ti -1c .RI "template<\fBtypename\fP \fB_UIntType1\fP , \fB_UIntType1\fP __a1, \fB_UIntType1\fP __c1, \fB_UIntType1\fP __m1, \fBtypename\fP _CharT , \fBtypename\fP _Traits > \fBstd::basic_istream\fP< _CharT, _Traits > & \fBoperator>>\fP (\fBstd::basic_istream\fP< _CharT, _Traits > &\fB__is\fP, \fBstd::linear_congruential_engine\fP< \fB_UIntType1\fP, __a1, __c1, \fB__m1\fP > &\fB__lcr\fP)" .br .RI "Sets the state of the engine by reading its textual representation from \fC__is\fP\&. " .in -1c .SH "Detailed Description" .PP .SS "template<\fBtypename\fP _UIntType, _UIntType __a, _UIntType __c, _UIntType __m> .br 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 \] .PP The template parameter \fC_UIntType\fP must be an unsigned integral type large enough to store values up to (__m-1)\&. If the template parameter \fC__m\fP is 0, the modulus \fC__m\fP used is std::numeric_limits<_UIntType>::max() plus 1\&. Otherwise, the template parameters \fC__a\fP and \fC__c\fP must be less than \fC__m\fP\&. .PP The size of the state is $1$\&. .PP Definition at line \fB244\fP of file \fBrandom\&.h\fP\&. .SH "Member Typedef Documentation" .PP .SS "template<\fBtypename\fP _UIntType , _UIntType __a, _UIntType __c, _UIntType __m> \fBtypedef\fP _UIntType \fBstd::linear_congruential_engine\fP< _UIntType, __a, __c, __m >::result_type" The type of the generated random value\&. .PP Definition at line \fB257\fP of file \fBrandom\&.h\fP\&. .SH "Constructor & Destructor Documentation" .PP .SS "template<\fBtypename\fP _UIntType , _UIntType __a, _UIntType __c, _UIntType __m> \fBstd::linear_congruential_engine\fP< _UIntType, __a, __c, __m >::linear_congruential_engine ()\fC [inline]\fP" .PP Constructs a linear_congruential_engine random number generator engine with seed 1\&. .PP Definition at line \fB271\fP of file \fBrandom\&.h\fP\&. .SS "template<\fBtypename\fP _UIntType , _UIntType __a, _UIntType __c, _UIntType __m> \fBstd::linear_congruential_engine\fP< _UIntType, __a, __c, __m >::linear_congruential_engine (\fBresult_type\fP __s)\fC [inline]\fP, \fC [explicit]\fP" .PP Constructs a linear_congruential_engine random number generator engine with seed \fC__s\fP\&. The default seed value is 1\&. .PP \fBParameters\fP .RS 4 \fI__s\fP The initial seed value\&. .RE .PP .PP Definition at line \fB282\fP of file \fBrandom\&.h\fP\&. .PP References \fBstd::linear_congruential_engine< _UIntType, __a, __c, __m >::seed()\fP\&. .SS "template<\fBtypename\fP _UIntType , _UIntType __a, _UIntType __c, _UIntType __m> template<\fBtypename\fP \fB_Sseq\fP , \fBtypename\fP = _If_seed_seq<_Sseq>> \fBstd::linear_congruential_engine\fP< _UIntType, __a, __c, __m >::linear_congruential_engine (\fB_Sseq\fP & __q)\fC [inline]\fP, \fC [explicit]\fP" .PP Constructs a linear_congruential_engine random number generator engine seeded from the seed sequence \fC__q\fP\&. .PP \fBParameters\fP .RS 4 \fI__q\fP the seed sequence\&. .RE .PP .PP Definition at line \fB293\fP of file \fBrandom\&.h\fP\&. .PP References \fBstd::linear_congruential_engine< _UIntType, __a, __c, __m >::seed()\fP\&. .SH "Member Function Documentation" .PP .SS "template<\fBtypename\fP _UIntType , _UIntType __a, _UIntType __c, _UIntType __m> \fBvoid\fP \fBstd::linear_congruential_engine\fP< _UIntType, __a, __c, __m >::discard (unsigned long long __z)\fC [inline]\fP" .PP Discard a sequence of random numbers\&. .PP Definition at line \fB337\fP of file \fBrandom\&.h\fP\&. .SS "template<\fBtypename\fP _UIntType , _UIntType __a, _UIntType __c, _UIntType __m> \fBstatic\fP \fBconstexpr\fP \fBresult_type\fP \fBstd::linear_congruential_engine\fP< _UIntType, __a, __c, __m >::max ()\fC [inline]\fP, \fC [static]\fP, \fC [constexpr]\fP" .PP Gets the largest possible value in the output range\&. .PP Definition at line \fB330\fP of file \fBrandom\&.h\fP\&. .SS "template<\fBtypename\fP _UIntType , _UIntType __a, _UIntType __c, _UIntType __m> \fBstatic\fP \fBconstexpr\fP \fBresult_type\fP \fBstd::linear_congruential_engine\fP< _UIntType, __a, __c, __m >::min ()\fC [inline]\fP, \fC [static]\fP, \fC [constexpr]\fP" .PP Gets the smallest possible value in the output range\&. The minimum depends on the \fC__c\fP parameter: if it is zero, the minimum generated must be > 0, otherwise 0 is allowed\&. .PP Definition at line \fB323\fP of file \fBrandom\&.h\fP\&. .SS "template<\fBtypename\fP _UIntType , _UIntType __a, _UIntType __c, _UIntType __m> \fBresult_type\fP \fBstd::linear_congruential_engine\fP< _UIntType, __a, __c, __m >::operator() ()\fC [inline]\fP" .PP Gets the next random number in the sequence\&. .PP Definition at line \fB347\fP of file \fBrandom\&.h\fP\&. .SS "template<\fBtypename\fP _UIntType , _UIntType __a, _UIntType __c, _UIntType __m> template<\fBtypename\fP \fB_Sseq\fP > _If_seed_seq< \fB_Sseq\fP > \fBstd::linear_congruential_engine\fP< _UIntType, __a, __c, __m >::seed (\fB_Sseq\fP & __q)" .PP Reseeds the linear_congruential_engine random number generator engine sequence using values from the seed sequence \fC__q\fP\&. .PP \fBParameters\fP .RS 4 \fI__q\fP the seed sequence\&. .RE .PP .SS "template<\fBtypename\fP _UIntType , _UIntType __a, _UIntType __c, _UIntType __m> template<\fBtypename\fP \fB_Sseq\fP > \fBauto\fP \fBstd::linear_congruential_engine\fP< _UIntType, __a, __c, __m >::seed (\fB_Sseq\fP & __q) \-> _If_seed_seq<\fB_Sseq\fP> " Seeds the LCR engine with a value generated by \fC__q\fP\&. .PP Definition at line \fB132\fP of file \fBbits/random\&.tcc\fP\&. .PP References \fBstd::__lg()\fP\&. .SS "template<\fBtypename\fP _UIntType , _UIntType __a, _UIntType __c, _UIntType __m> \fBvoid\fP \fBstd::linear_congruential_engine\fP< _UIntType, __a, __c, __m >::seed (\fBresult_type\fP __s = \fCdefault_seed\fP)" .PP Reseeds the linear_congruential_engine random number generator engine sequence to the seed \fC__s\fP\&. .PP \fBParameters\fP .RS 4 \fI__s\fP The new seed\&. .RE .PP Seeds the LCR with integral value \fC__s\fP, adjusted so that the ring identity is never a member of the convergence set\&. .PP Definition at line \fB116\fP of file \fBbits/random\&.tcc\fP\&. .PP Referenced by \fBstd::linear_congruential_engine< _UIntType, __a, __c, __m >::linear_congruential_engine()\fP, and \fBstd::linear_congruential_engine< _UIntType, __a, __c, __m >::linear_congruential_engine()\fP\&. .SH "Friends And Related Symbol Documentation" .PP .SS "template<\fBtypename\fP _UIntType , _UIntType __a, _UIntType __c, _UIntType __m> template<\fBtypename\fP \fB_UIntType1\fP , \fB_UIntType1\fP __a1, \fB_UIntType1\fP __c1, \fB_UIntType1\fP __m1, \fBtypename\fP _CharT , \fBtypename\fP _Traits > \fBstd::basic_ostream\fP< _CharT, _Traits > & \fBoperator\fP<< (\fBstd::basic_ostream\fP< _CharT, _Traits > & __os, \fBconst\fP \fBstd::linear_congruential_engine\fP< \fB_UIntType1\fP, __a1, __c1, \fB__m1\fP > & __lcr)\fC [friend]\fP" .PP Writes the textual representation of the state x(i) of x to \fC__os\fP\&. .PP \fBParameters\fP .RS 4 \fI__os\fP The output stream\&. .br \fI__lcr\fP A % linear_congruential_engine random number generator\&. .RE .PP \fBReturns\fP .RS 4 __os\&. .RE .PP .SS "template<\fBtypename\fP _UIntType , _UIntType __a, _UIntType __c, _UIntType __m> bool \fBoperator\fP== (\fBconst\fP \fBlinear_congruential_engine\fP< _UIntType, __a, __c, __m > & __lhs, \fBconst\fP \fBlinear_congruential_engine\fP< _UIntType, __a, __c, __m > & __rhs)\fC [friend]\fP" .PP Compares two linear congruential random number generator objects of the same type for equality\&. .PP \fBParameters\fP .RS 4 \fI__lhs\fP A linear congruential random number generator object\&. .br \fI__rhs\fP Another linear congruential random number generator object\&. .RE .PP \fBReturns\fP .RS 4 true if the infinite sequences of generated values would be equal, false otherwise\&. .RE .PP .PP Definition at line \fB365\fP of file \fBrandom\&.h\fP\&. .SS "template<\fBtypename\fP _UIntType , _UIntType __a, _UIntType __c, _UIntType __m> template<\fBtypename\fP \fB_UIntType1\fP , \fB_UIntType1\fP __a1, \fB_UIntType1\fP __c1, \fB_UIntType1\fP __m1, \fBtypename\fP _CharT , \fBtypename\fP _Traits > \fBstd::basic_istream\fP< _CharT, _Traits > & \fBoperator\fP>> (\fBstd::basic_istream\fP< _CharT, _Traits > & __is, \fBstd::linear_congruential_engine\fP< \fB_UIntType1\fP, __a1, __c1, \fB__m1\fP > & __lcr)\fC [friend]\fP" .PP Sets the state of the engine by reading its textual representation from \fC__is\fP\&. The textual representation must have been previously written using an output stream whose imbued locale and whose type's template specialization arguments _CharT and _Traits were the same as those of \fC__is\fP\&. .PP \fBParameters\fP .RS 4 \fI__is\fP The input stream\&. .br \fI__lcr\fP A % linear_congruential_engine random number generator\&. .RE .PP \fBReturns\fP .RS 4 __is\&. .RE .PP .SH "Member Data Documentation" .PP .SS "template<\fBtypename\fP _UIntType , _UIntType __a, _UIntType __c, _UIntType __m> \fBconstexpr\fP _UIntType \fBstd::linear_congruential_engine\fP< _UIntType, __a, __c, __m >::default_seed\fC [static]\fP, \fC [constexpr]\fP" .PP Definition at line \fB265\fP of file \fBrandom\&.h\fP\&. .SS "template<\fBtypename\fP _UIntType , _UIntType __a, _UIntType __c, _UIntType __m> \fBconstexpr\fP _UIntType \fBstd::linear_congruential_engine\fP< _UIntType, __a, __c, __m >::increment\fC [static]\fP, \fC [constexpr]\fP" An increment\&. .PP Definition at line \fB262\fP of file \fBrandom\&.h\fP\&. .SS "template<\fBtypename\fP _UIntType , _UIntType __a, _UIntType __c, _UIntType __m> \fBconstexpr\fP _UIntType \fBstd::linear_congruential_engine\fP< _UIntType, __a, __c, __m >::modulus\fC [static]\fP, \fC [constexpr]\fP" The modulus\&. .PP Definition at line \fB264\fP of file \fBrandom\&.h\fP\&. .SS "template<\fBtypename\fP _UIntType , _UIntType __a, _UIntType __c, _UIntType __m> \fBconstexpr\fP _UIntType \fBstd::linear_congruential_engine\fP< _UIntType, __a, __c, __m >::multiplier\fC [static]\fP, \fC [constexpr]\fP" The multiplier\&. .PP Definition at line \fB260\fP of file \fBrandom\&.h\fP\&. .SH "Author" .PP Generated automatically by Doxygen for libstdc++ from the source code\&.