.TH "std::subtract_with_carry_engine< _UIntType, __w, __s, __r >" 3cxx "Mon May 22 2017" "libstdc++" \" -*- nroff -*- .ad l .nh .SH NAME std::subtract_with_carry_engine< _UIntType, __w, __s, __r > \- The Marsaglia-Zaman 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 "\fBsubtract_with_carry_engine\fP (\fBresult_type\fP __sd=default_seed)" .br .RI "Constructs an explicitly seeded % subtract_with_carry_engine random number generator\&. " .ti -1c .RI "template::value> ::type> \fBsubtract_with_carry_engine\fP (_Sseq &__q)" .br .RI "Constructs a subtract_with_carry_engine random number engine seeded from the seed sequence \fC__q\fP\&. " .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 "void \fBseed\fP (\fBresult_type\fP __sd=default_seed)" .br .RI "Seeds the initial state $x_0$ of the random number generator\&. " .ti -1c .RI "template std::enable_if< \fBstd::is_class\fP< _Sseq >::value >::type \fBseed\fP (_Sseq &__q)" .br .RI "Seeds the initial state $x_0$ of the % subtract_with_carry_engine random number generator\&. " .in -1c .SS "Static Public Member Functions" .in +1c .ti -1c .RI "static constexpr \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 "static constexpr \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 "static constexpr \fBresult_type\fP \fBdefault_seed\fP" .br .ti -1c .RI "static constexpr size_t \fBlong_lag\fP" .br .ti -1c .RI "static constexpr size_t \fBshort_lag\fP" .br .ti -1c .RI "static constexpr size_t \fBword_size\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::subtract_with_carry_engine\fP< _UIntType1, __w1, __s1, __r1 > &__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 (const \fBsubtract_with_carry_engine\fP &__lhs, const \fBsubtract_with_carry_engine\fP &__rhs)" .br .RI "Compares two % subtract_with_carry_engine 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::subtract_with_carry_engine\fP< _UIntType1, __w1, __s1, __r1 > &__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 .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)$\&. .PP Definition at line 659 of file random\&.h\&. .SH "Member Typedef Documentation" .PP .SS "template typedef _UIntType \fBstd::subtract_with_carry_engine\fP< _UIntType, __w, __s, __r >::\fBresult_type\fP" The type of the generated random value\&. .PP Definition at line 662 of file random\&.h\&. .SH "Constructor & Destructor Documentation" .PP .SS "template \fBstd::subtract_with_carry_engine\fP< _UIntType, __w, __s, __r >::\fBsubtract_with_carry_engine\fP (\fBresult_type\fP __sd = \fCdefault_seed\fP)\fC [inline]\fP, \fC [explicit]\fP" .PP Constructs an explicitly seeded % subtract_with_carry_engine random number generator\&. .PP Definition at line 683 of file random\&.h\&. .SS "template template::value> ::type> \fBstd::subtract_with_carry_engine\fP< _UIntType, __w, __s, __r >::\fBsubtract_with_carry_engine\fP (_Sseq & __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 Definition at line 696 of file random\&.h\&. .SH "Member Function Documentation" .PP .SS "template void \fBstd::subtract_with_carry_engine\fP< _UIntType, __w, __s, __r >::discard (unsigned long long __z)\fC [inline]\fP" .PP Discard a sequence of random numbers\&. .PP Definition at line 742 of file random\&.h\&. .SS "template static constexpr \fBresult_type\fP \fBstd::subtract_with_carry_engine\fP< _UIntType, __w, __s, __r >::max ()\fC [inline]\fP, \fC [static]\fP" .PP Gets the inclusive maximum value of the range of random integers returned by this generator\&. .PP Definition at line 735 of file random\&.h\&. .SS "template static constexpr \fBresult_type\fP \fBstd::subtract_with_carry_engine\fP< _UIntType, __w, __s, __r >::min ()\fC [inline]\fP, \fC [static]\fP" .PP Gets the inclusive minimum value of the range of random integers returned by this generator\&. .PP Definition at line 727 of file random\&.h\&. .SS "template \fBsubtract_with_carry_engine\fP< _UIntType, __w, __s, __r >::\fBresult_type\fP \fBstd::subtract_with_carry_engine\fP< _UIntType, __w, __s, __r >::operator() ()" .PP Gets the next random number in the sequence\&. .PP Definition at line 598 of file bits/random\&.tcc\&. .PP References std::dec(), std::fixed(), std::ios_base::flags(), std::left(), std::discard_block_engine< _RandomNumberEngine, __p, __r >::operator()(), std::__detail::operator>>(), and std::skipws()\&. .PP Referenced by std::subtract_with_carry_engine< _UIntType, __w, __s, __r >::seed()\&. .SS "template void \fBstd::subtract_with_carry_engine\fP< _UIntType, __w, __s, __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 Definition at line 543 of file bits/random\&.tcc\&. .PP Referenced by std::mersenne_twister_engine< uint_fast32_t, 32, 624, 397, 31, 0x9908b0dfUL, 11, 0xffffffffUL, 7, 0x9d2c5680UL, 15, 0xefc60000UL, 18, 1812433253UL >::discard()\&. .SS "template template std::enable_if< \fBstd::is_class\fP< _Sseq >::value >::type \fBstd::subtract_with_carry_engine\fP< _UIntType, __w, __s, __r >::seed (_Sseq & __q)" .PP Seeds the initial state $x_0$ of the % subtract_with_carry_engine random number generator\&. .PP Definition at line 572 of file bits/random\&.tcc\&. .PP References std::subtract_with_carry_engine< _UIntType, __w, __s, __r >::operator()()\&. .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::subtract_with_carry_engine\fP< _UIntType1, __w1, __s1, __r1 > & __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 bool operator== (const \fBsubtract_with_carry_engine\fP< _UIntType, __w, __s, __r > & __lhs, const \fBsubtract_with_carry_engine\fP< _UIntType, __w, __s, __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 .PP Definition at line 767 of file random\&.h\&. .SS "template template \fBstd::basic_istream\fP<_CharT, _Traits>& operator>> (\fBstd::basic_istream\fP< _CharT, _Traits > & __is, \fBstd::subtract_with_carry_engine\fP< _UIntType1, __w1, __s1, __r1 > & __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\&.