.TH "std::linear_congruential_engine< _UIntType, __a, __c, __m >" 3cxx "Wed Jul 14 2021" "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 .SS "Public Types" .in +1c .ti -1c .RI "typedef _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> \fBlinear_congruential_engine\fP (_Sseq &__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 __s)" .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 "void \fBdiscard\fP (unsigned long long __z)" .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 _If_seed_seq< _Sseq > \fBseed\fP (_Sseq &__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 auto \fBseed\fP (_Sseq &__q) \-> _If_seed_seq< _Sseq >" .br .ti -1c .RI "void \fBseed\fP (\fBresult_type\fP __s=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 "static constexpr \fBresult_type\fP \fBmax\fP ()" .br .RI "Gets the largest possible value in the output range\&. " .ti -1c .RI "static constexpr \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 "static constexpr \fBresult_type\fP \fBdefault_seed\fP" .br .ti -1c .RI "static constexpr \fBresult_type\fP \fBincrement\fP" .br .ti -1c .RI "static constexpr \fBresult_type\fP \fBmodulus\fP" .br .ti -1c .RI "static constexpr \fBresult_type\fP \fBmultiplier\fP" .br .in -1c .SS "Friends" .in +1c .ti -1c .RI "template \fBstd::basic_ostream\fP< _CharT, _Traits > & \fBoperator<<\fP (\fBstd::basic_ostream\fP< _CharT, _Traits > &__os, const \fBstd::linear_congruential_engine\fP< _UIntType1, __a1, __c1, __m1 > &__lcr)" .br .RI "Writes the textual representation of the state x(i) of x to \fC__os\fP\&. " .ti -1c .RI "bool \fBoperator==\fP (const \fBlinear_congruential_engine\fP &__lhs, const \fBlinear_congruential_engine\fP &__rhs)" .br .RI "Compares two linear congruential random number generator objects of the same type for equality\&. " .ti -1c .RI "template \fBstd::basic_istream\fP< _CharT, _Traits > & \fBoperator>>\fP (\fBstd::basic_istream\fP< _CharT, _Traits > &__is, \fBstd::linear_congruential_engine\fP< _UIntType1, __a1, __c1, __m1 > &__lcr)" .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 .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 255 of file random\&.h\&. .SH "Member Typedef Documentation" .PP .SS "template typedef _UIntType \fBstd::linear_congruential_engine\fP< _UIntType, __a, __c, __m >::\fBresult_type\fP" The type of the generated random value\&. .PP Definition at line 268 of file random\&.h\&. .SH "Constructor & Destructor Documentation" .PP .SS "template \fBstd::linear_congruential_engine\fP< _UIntType, __a, __c, __m >::\fBlinear_congruential_engine\fP ()\fC [inline]\fP" .PP Constructs a linear_congruential_engine random number generator engine with seed 1\&. .PP Definition at line 282 of file random\&.h\&. .SS "template \fBstd::linear_congruential_engine\fP< _UIntType, __a, __c, __m >::\fBlinear_congruential_engine\fP (\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 293 of file random\&.h\&. .PP References std::linear_congruential_engine< _UIntType, __a, __c, __m >::seed()\&. .SS "template template> \fBstd::linear_congruential_engine\fP< _UIntType, __a, __c, __m >::\fBlinear_congruential_engine\fP (_Sseq & __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 304 of file random\&.h\&. .PP References std::linear_congruential_engine< _UIntType, __a, __c, __m >::seed()\&. .SH "Member Function Documentation" .PP .SS "template void \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 348 of file random\&.h\&. .SS "template static constexpr \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 341 of file random\&.h\&. .SS "template static constexpr \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 334 of file random\&.h\&. .SS "template \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 358 of file random\&.h\&. .SS "template template _If_seed_seq<_Sseq> \fBstd::linear_congruential_engine\fP< _UIntType, __a, __c, __m >::seed (_Sseq & __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 template auto \fBstd::linear_congruential_engine\fP< _UIntType, __a, __c, __m >::seed (_Sseq & __q) \-> _If_seed_seq<_Sseq> " Seeds the LCR engine with a value generated by \fC__q\fP\&. .PP Definition at line 132 of file bits/random\&.tcc\&. .PP References std::__lg()\&. .SS "template void \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 116 of file bits/random\&.tcc\&. .PP Referenced by std::linear_congruential_engine< _UIntType, __a, __c, __m >::linear_congruential_engine()\&. .SH "Friends And Related Function Documentation" .PP .SS "template template \fBstd::basic_ostream\fP<_CharT, _Traits>& operator<< (\fBstd::basic_ostream\fP< _CharT, _Traits > & __os, const \fBstd::linear_congruential_engine\fP< _UIntType1, __a1, __c1, __m1 > & __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 bool operator== (const \fBlinear_congruential_engine\fP< _UIntType, __a, __c, __m > & __lhs, const \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 376 of file random\&.h\&. .SS "template template \fBstd::basic_istream\fP<_CharT, _Traits>& operator>> (\fBstd::basic_istream\fP< _CharT, _Traits > & __is, \fBstd::linear_congruential_engine\fP< _UIntType1, __a1, __c1, __m1 > & __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 constexpr _UIntType \fBstd::linear_congruential_engine\fP< _UIntType, __a, __c, __m >::increment\fC [static]\fP, \fC [constexpr]\fP" An increment\&. .PP Definition at line 273 of file random\&.h\&. .SS "template constexpr _UIntType \fBstd::linear_congruential_engine\fP< _UIntType, __a, __c, __m >::\fBmodulus\fP\fC [static]\fP, \fC [constexpr]\fP" The modulus\&. .PP Definition at line 275 of file random\&.h\&. .SS "template constexpr _UIntType \fBstd::linear_congruential_engine\fP< _UIntType, __a, __c, __m >::multiplier\fC [static]\fP, \fC [constexpr]\fP" The multiplier\&. .PP Definition at line 271 of file random\&.h\&. .SH "Author" .PP Generated automatically by Doxygen for libstdc++ from the source code\&.