std::subtract_with_carry_engine< _UIntType, __w, __s, __r >

Section: C Library Functions (3)
Updated: Wed Apr 17 2019
Page Index
 

NAME

std::subtract_with_carry_engine< _UIntType, __w, __s, __r > - The Marsaglia-Zaman generator.

 

SYNOPSIS


 

Public Types


typedef _UIntType result_type
 

Public Member Functions


subtract_with_carry_engine (result_type __sd=default_seed)
Constructs an explicitly seeded % subtract_with_carry_engine random number generator.
template<typename _Sseq , typename = typename std::enable_if<!std::is_same<_Sseq, subtract_with_carry_engine>::value> ::type> subtract_with_carry_engine (_Sseq &__q)
Constructs a subtract_with_carry_engine random number engine seeded from the seed sequence __q.
void discard (unsigned long long __z)
Discard a sequence of random numbers.
result_type operator() ()
Gets the next random number in the sequence.
void seed (result_type __sd=default_seed)
Seeds the initial state $x_0$ of the random number generator.
template<typename _Sseq > std::enable_if< std::is_class< _Sseq >::value >::type seed (_Sseq &__q)
Seeds the initial state $x_0$ of the % subtract_with_carry_engine random number generator.  

Static Public Member Functions


static constexpr result_type max ()
Gets the inclusive maximum value of the range of random integers returned by this generator.
static constexpr result_type min ()
Gets the inclusive minimum value of the range of random integers returned by this generator.  

Static Public Attributes


static constexpr result_type default_seed

static constexpr size_t long_lag

static constexpr size_t short_lag

static constexpr size_t word_size
 

Friends


template<typename _UIntType1 , size_t __w1, size_t __s1, size_t __r1, typename _CharT , typename _Traits > std::basic_ostream< _CharT, _Traits > & operator<< (std::basic_ostream< _CharT, _Traits > &__os, const std::subtract_with_carry_engine< _UIntType1, __w1, __s1, __r1 > &__x)
Inserts the current state of a % subtract_with_carry_engine random number generator engine __x into the output stream __os.
bool operator== (const subtract_with_carry_engine &__lhs, const subtract_with_carry_engine &__rhs)
Compares two % subtract_with_carry_engine random number generator objects of the same type for equality.
template<typename _UIntType1 , size_t __w1, size_t __s1, size_t __r1, typename _CharT , typename _Traits > std::basic_istream< _CharT, _Traits > & operator>> (std::basic_istream< _CharT, _Traits > &__is, std::subtract_with_carry_engine< _UIntType1, __w1, __s1, __r1 > &__x)
Extracts the current state of a % subtract_with_carry_engine random number generator engine __x from the input stream __is.  

Detailed Description

 

template<typename _UIntType, size_t __w, size_t __s, size_t __r>


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.

A discrete random number generator that produces pseudorandom numbers using: \

The size of the state is $r$ and the maximum period of the generator is $(m^r - m^s - 1)$.

Definition at line 652 of file random.h.  

Member Typedef Documentation

 

template<typename _UIntType, size_t __w, size_t __s, size_t __r> typedef _UIntType std::subtract_with_carry_engine< _UIntType, __w, __s, __r >::result_type

The type of the generated random value.

Definition at line 655 of file random.h.  

Constructor & Destructor Documentation

 

template<typename _UIntType, size_t __w, size_t __s, size_t __r> std::subtract_with_carry_engine< _UIntType, __w, __s, __r >::subtract_with_carry_engine (result_type __sd = default_seed) [inline], [explicit]

Constructs an explicitly seeded % subtract_with_carry_engine random number generator.

Definition at line 676 of file random.h.

References std::subtract_with_carry_engine< _UIntType, __w, __s, __r >::seed().  

template<typename _UIntType, size_t __w, size_t __s, size_t __r> template<typename _Sseq , typename = typename std::enable_if<!std::is_same<_Sseq, subtract_with_carry_engine>::value> ::type> std::subtract_with_carry_engine< _UIntType, __w, __s, __r >::subtract_with_carry_engine (_Sseq & __q) [inline], [explicit]

Constructs a subtract_with_carry_engine random number engine seeded from the seed sequence __q.

Parameters:

__q the seed sequence.

Definition at line 689 of file random.h.

References std::subtract_with_carry_engine< _UIntType, __w, __s, __r >::seed().  

Member Function Documentation

 

template<typename _UIntType, size_t __w, size_t __s, size_t __r> void std::subtract_with_carry_engine< _UIntType, __w, __s, __r >::discard (unsigned long long __z) [inline]

Discard a sequence of random numbers.

Definition at line 735 of file random.h.  

template<typename _UIntType, size_t __w, size_t __s, size_t __r> static constexpr result_type std::subtract_with_carry_engine< _UIntType, __w, __s, __r >::max () [inline], [static]

Gets the inclusive maximum value of the range of random integers returned by this generator.

Definition at line 728 of file random.h.  

template<typename _UIntType, size_t __w, size_t __s, size_t __r> static constexpr result_type std::subtract_with_carry_engine< _UIntType, __w, __s, __r >::min () [inline], [static]

Gets the inclusive minimum value of the range of random integers returned by this generator.

Definition at line 720 of file random.h.  

template<typename _UIntType , size_t __w, size_t __s, size_t __r> subtract_with_carry_engine< _UIntType, __w, __s, __r >::result_type std::subtract_with_carry_engine< _UIntType, __w, __s, __r >::operator() ()

Gets the next random number in the sequence.

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

template<typename _UIntType , size_t __w, size_t __s, size_t __r> void std::subtract_with_carry_engine< _UIntType, __w, __s, __r >::seed (result_type __sd = default_seed)

Seeds the initial state $x_0$ of the random number generator. N1688[4.19] modifies this as follows. If __value == 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} ots x_{-1} $ to $ lcg(1) ots lcg(r) $ respectively. If $ x_{-1} = 0 $ set carry to 1, otherwise sets carry to 0.

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

Referenced by std::subtract_with_carry_engine< _UIntType, __w, __s, __r >::subtract_with_carry_engine().  

template<typename _UIntType , size_t __w, size_t __s, size_t __r> template<typename _Sseq > std::enable_if< std::is_class< _Sseq >::value >::type std::subtract_with_carry_engine< _UIntType, __w, __s, __r >::seed (_Sseq & __q)

Seeds the initial state $x_0$ of the % subtract_with_carry_engine random number generator.

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

Friends And Related Function Documentation

 

template<typename _UIntType, size_t __w, size_t __s, size_t __r> template<typename _UIntType1 , size_t __w1, size_t __s1, size_t __r1, typename _CharT , typename _Traits > std::basic_ostream<_CharT, _Traits>& operator<< (std::basic_ostream< _CharT, _Traits > & __os, const std::subtract_with_carry_engine< _UIntType1, __w1, __s1, __r1 > & __x) [friend]

Inserts the current state of a % subtract_with_carry_engine random number generator engine __x into the output stream __os.

Parameters:

__os An output stream.
__x A % subtract_with_carry_engine random number generator engine.

Returns:

The output stream with the state of __x inserted or in an error state.

 

template<typename _UIntType, size_t __w, size_t __s, size_t __r> bool operator== (const subtract_with_carry_engine< _UIntType, __w, __s, __r > & __lhs, const subtract_with_carry_engine< _UIntType, __w, __s, __r > & __rhs) [friend]

Compares two % subtract_with_carry_engine random number generator objects of the same type for equality.

Parameters:

__lhs A % subtract_with_carry_engine random number generator object.
__rhs Another % subtract_with_carry_engine random number generator object.

Returns:

true if the infinite sequences of generated values would be equal, false otherwise.

Definition at line 760 of file random.h.  

template<typename _UIntType, size_t __w, size_t __s, size_t __r> template<typename _UIntType1 , size_t __w1, size_t __s1, size_t __r1, typename _CharT , typename _Traits > std::basic_istream<_CharT, _Traits>& operator>> (std::basic_istream< _CharT, _Traits > & __is, std::subtract_with_carry_engine< _UIntType1, __w1, __s1, __r1 > & __x) [friend]

Extracts the current state of a % subtract_with_carry_engine random number generator engine __x from the input stream __is.

Parameters:

__is An input stream.
__x A % subtract_with_carry_engine random number generator engine.

Returns:

The input stream with the state of __x extracted or in an error state.

 

Author

Generated automatically by Doxygen for libstdc++ from the source code.


 

Index

NAME
SYNOPSIS
Public Types
Public Member Functions
Static Public Member Functions
Static Public Attributes
Friends
Detailed Description
template<typename _UIntType, size_t __w, size_t __s, size_t __r>
Member Typedef Documentation
template<typename _UIntType, size_t __w, size_t __s, size_t __r> typedef _UIntType std::subtract_with_carry_engine< _UIntType, __w, __s, __r >::result_type
Constructor & Destructor Documentation
template<typename _UIntType, size_t __w, size_t __s, size_t __r> std::subtract_with_carry_engine< _UIntType, __w, __s, __r >::subtract_with_carry_engine (result_type __sd = default_seed) [inline], [explicit]
template<typename _UIntType, size_t __w, size_t __s, size_t __r> template<typename _Sseq , typename = typename std::enable_if<!std::is_same<_Sseq, subtract_with_carry_engine>::value> ::type> std::subtract_with_carry_engine< _UIntType, __w, __s, __r >::subtract_with_carry_engine (_Sseq & __q) [inline], [explicit]
Member Function Documentation
template<typename _UIntType, size_t __w, size_t __s, size_t __r> void std::subtract_with_carry_engine< _UIntType, __w, __s, __r >::discard (unsigned long long __z) [inline]
template<typename _UIntType, size_t __w, size_t __s, size_t __r> static constexpr result_type std::subtract_with_carry_engine< _UIntType, __w, __s, __r >::max () [inline], [static]
template<typename _UIntType, size_t __w, size_t __s, size_t __r> static constexpr result_type std::subtract_with_carry_engine< _UIntType, __w, __s, __r >::min () [inline], [static]
template<typename _UIntType , size_t __w, size_t __s, size_t __r> subtract_with_carry_engine< _UIntType, __w, __s, __r >::result_type std::subtract_with_carry_engine< _UIntType, __w, __s, __r >::operator() ()
template<typename _UIntType , size_t __w, size_t __s, size_t __r> void std::subtract_with_carry_engine< _UIntType, __w, __s, __r >::seed (result_type __sd = default_seed)
template<typename _UIntType , size_t __w, size_t __s, size_t __r> template<typename _Sseq > std::enable_if< std::is_class< _Sseq >::value >::type std::subtract_with_carry_engine< _UIntType, __w, __s, __r >::seed (_Sseq & __q)
Friends And Related Function Documentation
template<typename _UIntType, size_t __w, size_t __s, size_t __r> template<typename _UIntType1 , size_t __w1, size_t __s1, size_t __r1, typename _CharT , typename _Traits > std::basic_ostream<_CharT, _Traits>& operator<< (std::basic_ostream< _CharT, _Traits > & __os, const std::subtract_with_carry_engine< _UIntType1, __w1, __s1, __r1 > & __x) [friend]
template<typename _UIntType, size_t __w, size_t __s, size_t __r> bool operator== (const subtract_with_carry_engine< _UIntType, __w, __s, __r > & __lhs, const subtract_with_carry_engine< _UIntType, __w, __s, __r > & __rhs) [friend]
template<typename _UIntType, size_t __w, size_t __s, size_t __r> template<typename _UIntType1 , size_t __w1, size_t __s1, size_t __r1, typename _CharT , typename _Traits > std::basic_istream<_CharT, _Traits>& operator>> (std::basic_istream< _CharT, _Traits > & __is, std::subtract_with_carry_engine< _UIntType1, __w1, __s1, __r1 > & __x) [friend]
Author