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>
class std::mersenne_twister_engine< _UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f >
A generalized feedback shift register discrete random number generator.
This algorithm avoids multiplication and division and is designed to be friendly to a pipelined architecture. If the parameters are chosen correctly, this generator will produce numbers with a very long period and fairly good apparent entropy, although still not cryptographically strong.
The best way to use this generator is with the predefined mt19937 class.
This algorithm was originally invented by Makoto Matsumoto and Takuji Nishimura.
- Template Parameters:
-
__w | Word size, the number of bits in each element of the state vector. |
__n | The degree of recursion. |
__m | The period parameter. |
__r | The separation point bit index. |
__a | The last row of the twist matrix. |
__u | The first right-shift tempering matrix parameter. |
__d | The first right-shift tempering matrix mask. |
__s | The first left-shift tempering matrix parameter. |
__b | The first left-shift tempering matrix mask. |
__t | The second left-shift tempering matrix parameter. |
__c | The second left-shift tempering matrix mask. |
__l | The second right-shift tempering matrix parameter. |
__f | Initialization multiplier. |
Definition at line 383 of file random.h.
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>
typedef _UIntType std::mersenne_twister_engine< _UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f >::result_type |
The type of the generated random value.
Definition at line 414 of file random.h.
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>
template<typename _Sseq , typename = typename std::enable_if<!std::is_same<_Sseq, mersenne_twister_engine>::value> ::type>
std::mersenne_twister_engine< _UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f >::mersenne_twister_engine |
( |
_Sseq & |
__q | ) |
[inline, explicit] |
Constructs a mersenne_twister_engine random number generator engine seeded from the seed sequence __q
.
- Parameters:
-
Definition at line 447 of file random.h.
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>
void std::mersenne_twister_engine< _UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f >::discard |
( |
unsigned long long |
__z | ) |
[inline] |
Discard a sequence of random numbers.
Definition at line 475 of file random.h.
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>
static constexpr result_type std::mersenne_twister_engine< _UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f >::max |
( |
| ) |
[inline, static] |
Gets the largest possible value in the output range.
Definition at line 468 of file random.h.
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>
static constexpr result_type std::mersenne_twister_engine< _UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f >::min |
( |
| ) |
[inline, static] |
Gets the smallest possible value in the output range.
Definition at line 461 of file random.h.
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>
template<typename _UIntType1 , size_t __w1, size_t __n1, size_t __m1, size_t __r1, _UIntType1 __a1, size_t __u1, _UIntType1 __d1, size_t __s1, _UIntType1 __b1, size_t __t1, _UIntType1 __c1, size_t __l1, _UIntType1 __f1, typename _CharT , typename _Traits >
std::basic_ostream<_CharT, _Traits>& operator<< |
( |
std::basic_ostream< _CharT, _Traits > & |
__os, |
|
|
const std::mersenne_twister_engine< _UIntType1, __w1, __n1, __m1, __r1, __a1, __u1, __d1, __s1, __b1, __t1, __c1, __l1, __f1 > & |
__x |
|
) |
| [friend] |
Inserts the current state of a % mersenne_twister_engine random number generator engine __x
into the output stream __os
.
- Parameters:
-
- Returns:
- The output stream with the state of
__x
inserted or in an error state.
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 operator== |
( |
const mersenne_twister_engine< _UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f > & |
__lhs, |
|
|
const mersenne_twister_engine< _UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f > & |
__rhs |
|
) |
| [friend] |
Compares two % mersenne_twister_engine random number generator objects of the same type for equality.
- Parameters:
-
- Returns:
- true if the infinite sequences of generated values would be equal, false otherwise.
Definition at line 497 of file random.h.
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>
template<typename _UIntType1 , size_t __w1, size_t __n1, size_t __m1, size_t __r1, _UIntType1 __a1, size_t __u1, _UIntType1 __d1, size_t __s1, _UIntType1 __b1, size_t __t1, _UIntType1 __c1, size_t __l1, _UIntType1 __f1, typename _CharT , typename _Traits >
std::basic_istream<_CharT, _Traits>& operator>> |
( |
std::basic_istream< _CharT, _Traits > & |
__is, |
|
|
std::mersenne_twister_engine< _UIntType1, __w1, __n1, __m1, __r1, __a1, __u1, __d1, __s1, __b1, __t1, __c1, __l1, __f1 > & |
__x |
|
) |
| [friend] |
Extracts the current state of a % mersenne_twister_engine random number generator engine __x
from the input stream __is
.
- Parameters:
-
- Returns:
- The input stream with the state of
__x
extracted or in an error state.