.TH "std::subtract_with_carry_engine< _UIntType, __w, __s, __r >" 3cxx "libstdc++" \" -*- nroff -*- .ad l .nh .SH NAME std::subtract_with_carry_engine< _UIntType, __w, __s, __r > \- The Marsaglia-Zaman 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 "template<\fBtypename\fP \fB_Sseq\fP , \fBtypename\fP = _If_seed_seq<_Sseq>> \fBsubtract_with_carry_engine\fP (\fB_Sseq\fP &__q)" .br .RI "Constructs a subtract_with_carry_engine random number engine seeded from the seed sequence \fC__q\fP\&. " .ti -1c .RI "\fBsubtract_with_carry_engine\fP (\fBresult_type\fP \fB__sd\fP)" .br .RI "Constructs an explicitly seeded subtract_with_carry_engine random number generator\&. " .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 "Seeds the initial state $x_0$ of the % subtract_with_carry_engine random number generator\&. " .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__sd\fP=default_seed)" .br .RI "Seeds the initial state $x_0$ of the random number generator\&. " .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 inclusive maximum value of the range of random integers returned by this generator\&. " .ti -1c .RI "\fBstatic\fP \fBconstexpr\fP \fBresult_type\fP \fBmin\fP ()" .br .RI "Gets the inclusive minimum value of the range of random integers returned by this generator\&. " .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 size_t \fBlong_lag\fP" .br .ti -1c .RI "\fBstatic\fP \fBconstexpr\fP size_t \fBshort_lag\fP" .br .ti -1c .RI "\fBstatic\fP \fBconstexpr\fP size_t \fBword_size\fP" .br .in -1c .SS "Friends" .in +1c .ti -1c .RI "template<\fBtypename\fP \fB_UIntType1\fP , size_t __w1, size_t __s1, size_t __r1, \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::subtract_with_carry_engine\fP< \fB_UIntType1\fP, \fB__w1\fP, \fB__s1\fP, \fB__r1\fP > &__x)" .br .RI "Inserts the current state of a % subtract_with_carry_engine random number generator engine \fC__x\fP into the output stream \fC__os\fP\&. " .ti -1c .RI "bool \fBoperator==\fP (\fBconst\fP \fBsubtract_with_carry_engine\fP &\fB__lhs\fP, \fBconst\fP \fBsubtract_with_carry_engine\fP &\fB__rhs\fP)" .br .RI "Compares two % subtract_with_carry_engine random number generator objects of the same type for equality\&. " .ti -1c .RI "template<\fBtypename\fP \fB_UIntType1\fP , size_t __w1, size_t __s1, size_t __r1, \fBtypename\fP _CharT , \fBtypename\fP _Traits > \fBstd::basic_istream\fP< _CharT, _Traits > & \fBoperator>>\fP (\fBstd::basic_istream\fP< _CharT, _Traits > &\fB__is\fP, \fBstd::subtract_with_carry_engine\fP< \fB_UIntType1\fP, \fB__w1\fP, \fB__s1\fP, \fB__r1\fP > &__x)" .br .RI "Extracts the current state of a % subtract_with_carry_engine random number generator engine \fC__x\fP from the input stream \fC__is\fP\&. " .in -1c .SH "Detailed Description" .PP .SS "template<\fBtypename\fP _UIntType, size_t __w, size_t __s, size_t __r> .br class std::subtract_with_carry_engine< _UIntType, __w, __s, __r >"The Marsaglia-Zaman generator\&. This is a model of a Generalized Fibonacci discrete random number generator, sometimes referred to as the SWC generator\&. .PP A discrete random number generator that produces pseudorandom numbers using: \[ x_{i}\leftarrow(x_{i - s} - x_{i - r} - carry_{i-1}) \bmod m \] .PP The size of the state is $r$ and the maximum period of the generator is $(m^r - m^s - 1)$\&. .SH "Member Typedef Documentation" .PP .SS "template<\fBtypename\fP _UIntType , size_t __w, size_t __s, size_t __r> \fBtypedef\fP _UIntType \fBstd::subtract_with_carry_engine\fP< _UIntType, \fB__w\fP, \fB__s\fP, __r >::result_type" The type of the generated random value\&. .SH "Constructor & Destructor Documentation" .PP .SS "template<\fBtypename\fP _UIntType , size_t __w, size_t __s, size_t __r> \fBstd::subtract_with_carry_engine\fP< _UIntType, \fB__w\fP, \fB__s\fP, __r >::subtract_with_carry_engine (\fBresult_type\fP __sd)\fC [inline]\fP, \fC [explicit]\fP" .PP Constructs an explicitly seeded subtract_with_carry_engine random number generator\&. .PP References \fBstd::subtract_with_carry_engine< _UIntType, __w, __s, __r >::seed()\fP\&. .SS "template<\fBtypename\fP _UIntType , size_t __w, size_t __s, size_t __r> template<\fBtypename\fP \fB_Sseq\fP , \fBtypename\fP = _If_seed_seq<_Sseq>> \fBstd::subtract_with_carry_engine\fP< _UIntType, \fB__w\fP, \fB__s\fP, __r >::subtract_with_carry_engine (\fB_Sseq\fP & __q)\fC [inline]\fP, \fC [explicit]\fP" .PP Constructs a subtract_with_carry_engine random number engine seeded from the seed sequence \fC__q\fP\&. .PP \fBParameters\fP .RS 4 \fI__q\fP the seed sequence\&. .RE .PP .PP References \fBstd::subtract_with_carry_engine< _UIntType, __w, __s, __r >::seed()\fP\&. .SH "Member Function Documentation" .PP .SS "template<\fBtypename\fP _UIntType , size_t __w, size_t __s, size_t __r> \fBvoid\fP \fBstd::subtract_with_carry_engine\fP< _UIntType, \fB__w\fP, \fB__s\fP, __r >::discard (unsigned long long __z)\fC [inline]\fP" .PP Discard a sequence of random numbers\&. .SS "template<\fBtypename\fP _UIntType , size_t __w, size_t __s, size_t __r> \fBstatic\fP \fBconstexpr\fP \fBresult_type\fP \fBstd::subtract_with_carry_engine\fP< _UIntType, \fB__w\fP, \fB__s\fP, __r >::max ()\fC [inline]\fP, \fC [static]\fP, \fC [constexpr]\fP" .PP Gets the inclusive maximum value of the range of random integers returned by this generator\&. .SS "template<\fBtypename\fP _UIntType , size_t __w, size_t __s, size_t __r> \fBstatic\fP \fBconstexpr\fP \fBresult_type\fP \fBstd::subtract_with_carry_engine\fP< _UIntType, \fB__w\fP, \fB__s\fP, __r >::min ()\fC [inline]\fP, \fC [static]\fP, \fC [constexpr]\fP" .PP Gets the inclusive minimum value of the range of random integers returned by this generator\&. .SS "template<\fBtypename\fP _UIntType , size_t __w, size_t __s, size_t __r> \fBsubtract_with_carry_engine\fP< _UIntType, \fB__w\fP, \fB__s\fP, __r >\fB::result_type\fP \fBstd::subtract_with_carry_engine\fP< _UIntType, \fB__w\fP, \fB__s\fP, __r >::operator() ()" .PP Gets the next random number in the sequence\&. .SS "template<\fBtypename\fP _UIntType , size_t __w, size_t __s, size_t __r> template<\fBtypename\fP \fB_Sseq\fP > _If_seed_seq< \fB_Sseq\fP > \fBstd::subtract_with_carry_engine\fP< _UIntType, \fB__w\fP, \fB__s\fP, __r >::seed (\fB_Sseq\fP & __q)" .PP Seeds the initial state $x_0$ of the % subtract_with_carry_engine random number generator\&. .SS "template<\fBtypename\fP _UIntType , size_t __w, size_t __s, size_t __r> \fBvoid\fP \fBstd::subtract_with_carry_engine\fP< _UIntType, \fB__w\fP, \fB__s\fP, __r >::seed (\fBresult_type\fP __sd = \fCdefault_seed\fP)" .PP Seeds the initial state $x_0$ of the random number generator\&. N1688[4\&.19] modifies this as follows\&. If \fC__value\fP == 0, sets value to 19780503\&. In any case, with a linear congruential generator lcg(i) having parameters $ m_{lcg} = 2147483563, a_{lcg} = 40014, c_{lcg} = 0, and lcg(0) = value $, sets $ x_{-r} \dots x_{-1} $ to $ lcg(1) \bmod m \dots lcg(r) \bmod m $ respectively\&. If $ x_{-1} = 0 $ set carry to 1, otherwise sets carry to 0\&. .PP Referenced by \fBstd::subtract_with_carry_engine< _UIntType, __w, __s, __r >::subtract_with_carry_engine()\fP, and \fBstd::subtract_with_carry_engine< _UIntType, __w, __s, __r >::subtract_with_carry_engine()\fP\&. .SH "Friends And Related Symbol Documentation" .PP .SS "template<\fBtypename\fP _UIntType , size_t __w, size_t __s, size_t __r> template<\fBtypename\fP \fB_UIntType1\fP , size_t __w1, size_t __s1, size_t __r1, \fBtypename\fP _CharT , \fBtypename\fP _Traits > \fBstd::basic_ostream\fP< _CharT, _Traits > & \fBoperator\fP<< (\fBstd::basic_ostream\fP< _CharT, _Traits > & __os, \fBconst\fP \fBstd::subtract_with_carry_engine\fP< \fB_UIntType1\fP, \fB__w1\fP, \fB__s1\fP, \fB__r1\fP > & __x)\fC [friend]\fP" .PP Inserts the current state of a % subtract_with_carry_engine random number generator engine \fC__x\fP into the output stream \fC__os\fP\&. .PP \fBParameters\fP .RS 4 \fI__os\fP An output stream\&. .br \fI__x\fP A % subtract_with_carry_engine random number generator engine\&. .RE .PP \fBReturns\fP .RS 4 The output stream with the state of \fC__x\fP inserted or in an error state\&. .RE .PP .SS "template<\fBtypename\fP _UIntType , size_t __w, size_t __s, size_t __r> bool \fBoperator\fP== (\fBconst\fP \fBsubtract_with_carry_engine\fP< _UIntType, \fB__w\fP, \fB__s\fP, __r > & __lhs, \fBconst\fP \fBsubtract_with_carry_engine\fP< _UIntType, \fB__w\fP, \fB__s\fP, __r > & __rhs)\fC [friend]\fP" .PP Compares two % subtract_with_carry_engine random number generator objects of the same type for equality\&. .PP \fBParameters\fP .RS 4 \fI__lhs\fP A % subtract_with_carry_engine random number generator object\&. .br \fI__rhs\fP Another % subtract_with_carry_engine 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 .SS "template<\fBtypename\fP _UIntType , size_t __w, size_t __s, size_t __r> template<\fBtypename\fP \fB_UIntType1\fP , size_t __w1, size_t __s1, size_t __r1, \fBtypename\fP _CharT , \fBtypename\fP _Traits > \fBstd::basic_istream\fP< _CharT, _Traits > & \fBoperator\fP>> (\fBstd::basic_istream\fP< _CharT, _Traits > & __is, \fBstd::subtract_with_carry_engine\fP< \fB_UIntType1\fP, \fB__w1\fP, \fB__s1\fP, \fB__r1\fP > & __x)\fC [friend]\fP" .PP Extracts the current state of a % subtract_with_carry_engine random number generator engine \fC__x\fP from the input stream \fC__is\fP\&. .PP \fBParameters\fP .RS 4 \fI__is\fP An input stream\&. .br \fI__x\fP A % subtract_with_carry_engine random number generator engine\&. .RE .PP \fBReturns\fP .RS 4 The input stream with the state of \fC__x\fP extracted or in an error state\&. .RE .PP .SH "Author" .PP Generated automatically by Doxygen for libstdc++ from the source code\&.