libstdc++
Random Number Generators
Collaboration diagram for Random Number Generators:

Typedefs

typedef minstd_rand0 std::default_random_engine
 
typedef shuffle_order_engine< minstd_rand0, 256 > std::knuth_b
 
typedef linear_congruential_engine< uint_fast32_t, 48271UL, 0UL, 2147483647UL > std::minstd_rand
 
typedef linear_congruential_engine< uint_fast32_t, 16807UL, 0UL, 2147483647UL > std::minstd_rand0
 
typedef mersenne_twister_engine< uint_fast32_t, 32, 624, 397, 31, 0x9908b0dfUL, 11, 0xffffffffUL, 7, 0x9d2c5680UL, 15, 0xefc60000UL, 18, 1812433253UL > std::mt19937
 
typedef mersenne_twister_engine< uint_fast64_t, 64, 312, 156, 31, 0xb5026f5aa96619e9ULL, 29, 0x5555555555555555ULL, 17, 0x71d67fffeda60000ULL, 37, 0xfff7eee000000000ULL, 43, 6364136223846793005ULL > std::mt19937_64
 
typedef discard_block_engine< ranlux24_base, 223, 23 > std::ranlux24
 
typedef subtract_with_carry_engine< uint_fast32_t, 24, 10, 24 > std::ranlux24_base
 
typedef discard_block_engine< ranlux48_base, 389, 11 > std::ranlux48
 
typedef subtract_with_carry_engine< uint_fast64_t, 48, 5, 12 > std::ranlux48_base
 

Functions

template<typename _RandomNumberEngine , size_t __p, size_t __r>
bool std::operator!= (const std::discard_block_engine< _RandomNumberEngine, __p, __r > &__lhs, const std::discard_block_engine< _RandomNumberEngine, __p, __r > &__rhs)
 
template<typename _RandomNumberEngine , size_t __w, typename _UIntType >
bool std::operator!= (const std::independent_bits_engine< _RandomNumberEngine, __w, _UIntType > &__lhs, const std::independent_bits_engine< _RandomNumberEngine, __w, _UIntType > &__rhs)
 
template<typename _UIntType , _UIntType __a, _UIntType __c, _UIntType __m>
bool std::operator!= (const std::linear_congruential_engine< _UIntType, __a, __c, __m > &__lhs, const std::linear_congruential_engine< _UIntType, __a, __c, __m > &__rhs)
 
template<typename _UIntType , size_t __w, size_t __n, size_t __m, size_t __r, _UIntType __a, size_t __u, _UIntType __d, size_t __s, _UIntType __b, size_t __t, _UIntType __c, size_t __l, _UIntType __f>
bool std::operator!= (const std::mersenne_twister_engine< _UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f > &__lhs, const std::mersenne_twister_engine< _UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f > &__rhs)
 
template<typename _RandomNumberEngine , size_t __k>
bool std::operator!= (const std::shuffle_order_engine< _RandomNumberEngine, __k > &__lhs, const std::shuffle_order_engine< _RandomNumberEngine, __k > &__rhs)
 
template<typename _UIntType , size_t __w, size_t __s, size_t __r>
bool std::operator!= (const std::subtract_with_carry_engine< _UIntType, __w, __s, __r > &__lhs, const std::subtract_with_carry_engine< _UIntType, __w, __s, __r > &__rhs)
 
template<typename _RandomNumberEngine , size_t __w, typename _UIntType , typename _CharT , typename _Traits >
std::basic_ostream< _CharT, _Traits > & std::operator<< (std::basic_ostream< _CharT, _Traits > &__os, const std::independent_bits_engine< _RandomNumberEngine, __w, _UIntType > &__x)
 

Detailed Description

These classes define objects which provide random or pseudorandom numbers, either from a discrete or a continuous interval. The random number generator supplied as a part of this library are all uniform random number generators which provide a sequence of random number uniformly distributed over their range.

A number generator is a function object with an operator() that takes zero arguments and returns a number.

A compliant random number generator must satisfy the following requirements.

Random Number Generator Requirements
To be documented.

Typedef Documentation

◆ minstd_rand

typedef linear_congruential_engine<uint_fast32_t, 48271UL, 0UL, 2147483647UL> std::minstd_rand

An alternative LCR (Lehmer Generator function).

Definition at line 1560 of file random.h.

◆ minstd_rand0

typedef linear_congruential_engine<uint_fast32_t, 16807UL, 0UL, 2147483647UL> std::minstd_rand0

The classic Minimum Standard rand0 of Lewis, Goodman, and Miller.

Definition at line 1554 of file random.h.

◆ mt19937

typedef mersenne_twister_engine< uint_fast32_t, 32, 624, 397, 31, 0x9908b0dfUL, 11, 0xffffffffUL, 7, 0x9d2c5680UL, 15, 0xefc60000UL, 18, 1812433253UL> std::mt19937

The classic Mersenne Twister.

Reference: M. Matsumoto and T. Nishimura, Mersenne Twister: A 623-Dimensionally Equidistributed Uniform Pseudo-Random Number Generator, ACM Transactions on Modeling and Computer Simulation, Vol. 8, No. 1, January 1998, pp 3-30.

Definition at line 1576 of file random.h.

◆ mt19937_64

typedef mersenne_twister_engine< uint_fast64_t, 64, 312, 156, 31, 0xb5026f5aa96619e9ULL, 29, 0x5555555555555555ULL, 17, 0x71d67fffeda60000ULL, 37, 0xfff7eee000000000ULL, 43, 6364136223846793005ULL> std::mt19937_64

An alternative Mersenne Twister.

Definition at line 1588 of file random.h.

Function Documentation

◆ operator!=() [1/6]

template<typename _RandomNumberEngine , size_t __p, size_t __r>
bool std::operator!= ( const std::discard_block_engine< _RandomNumberEngine, __p, __r > &  __lhs,
const std::discard_block_engine< _RandomNumberEngine, __p, __r > &  __rhs 
)
inline

Compares two discard_block_engine random number generator objects of the same type for inequality.

Parameters
__lhsA discard_block_engine random number generator object.
__rhsAnother discard_block_engine random number generator object.
Returns
true if the infinite sequences of generated values would be different, false otherwise.

Definition at line 1093 of file random.h.

◆ operator!=() [2/6]

template<typename _RandomNumberEngine , size_t __w, typename _UIntType >
bool std::operator!= ( const std::independent_bits_engine< _RandomNumberEngine, __w, _UIntType > &  __lhs,
const std::independent_bits_engine< _RandomNumberEngine, __w, _UIntType > &  __rhs 
)
inline

Compares two independent_bits_engine random number generator objects of the same type for inequality.

Parameters
__lhsA independent_bits_engine random number generator object.
__rhsAnother independent_bits_engine random number generator object.
Returns
true if the infinite sequences of generated values would be different, false otherwise.

Definition at line 1290 of file random.h.

◆ operator!=() [3/6]

template<typename _UIntType , _UIntType __a, _UIntType __c, _UIntType __m>
bool std::operator!= ( const std::linear_congruential_engine< _UIntType, __a, __c, __m > &  __lhs,
const std::linear_congruential_engine< _UIntType, __a, __c, __m > &  __rhs 
)
inline

Compares two linear congruential random number generator objects of the same type for inequality.

Parameters
__lhsA linear congruential random number generator object.
__rhsAnother linear congruential random number generator object.
Returns
true if the infinite sequences of generated values would be different, false otherwise.

Definition at line 432 of file random.h.

◆ operator!=() [4/6]

template<typename _UIntType , size_t __w, size_t __n, size_t __m, size_t __r, _UIntType __a, size_t __u, _UIntType __d, size_t __s, _UIntType __b, size_t __t, _UIntType __c, size_t __l, _UIntType __f>
bool std::operator!= ( const std::mersenne_twister_engine< _UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f > &  __lhs,
const std::mersenne_twister_engine< _UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f > &  __rhs 
)
inline

Compares two % mersenne_twister_engine random number generator objects of the same type for inequality.

Parameters
__lhsA % mersenne_twister_engine random number generator object.
__rhsAnother % mersenne_twister_engine random number generator object.
Returns
true if the infinite sequences of generated values would be different, false otherwise.

Definition at line 669 of file random.h.

◆ operator!=() [5/6]

template<typename _RandomNumberEngine , size_t __k>
bool std::operator!= ( const std::shuffle_order_engine< _RandomNumberEngine, __k > &  __lhs,
const std::shuffle_order_engine< _RandomNumberEngine, __k > &  __rhs 
)
inline

Compares two shuffle_order_engine random number generator objects of the same type for inequality.

Parameters
__lhsA shuffle_order_engine random number generator object.
__rhsAnother shuffle_order_engine random number generator object.
Returns
true if the infinite sequences of generated values would be different, false otherwise.

Definition at line 1543 of file random.h.

◆ operator!=() [6/6]

template<typename _UIntType , size_t __w, size_t __s, size_t __r>
bool std::operator!= ( const std::subtract_with_carry_engine< _UIntType, __w, __s, __r > &  __lhs,
const std::subtract_with_carry_engine< _UIntType, __w, __s, __r > &  __rhs 
)
inline

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

Parameters
__lhsA % subtract_with_carry_engine random number generator object.
__rhsAnother % subtract_with_carry_engine random number generator object.
Returns
true if the infinite sequences of generated values would be different, false otherwise.

Definition at line 870 of file random.h.

◆ operator<<()

template<typename _RandomNumberEngine , size_t __w, typename _UIntType , typename _CharT , typename _Traits >
std::basic_ostream<_CharT, _Traits>& std::operator<< ( std::basic_ostream< _CharT, _Traits > &  __os,
const std::independent_bits_engine< _RandomNumberEngine, __w, _UIntType > &  __x 
)

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

Parameters
__osAn output stream.
__xA independent_bits_engine random number generator engine.
Returns
The output stream with the state of __x inserted or in an error state.

Definition at line 1290 of file random.h.