alternative Standard Libary  0.29.8
std::mersenne_twister_engine< UIntType, w, n, m, r, a, u, d, s, b, t, c, l, f > Template-Klassenreferenz

#include <mersenne_twister_engine.hpp>

Öffentliche Typen

using result_type = UIntType
 

Öffentliche Methoden

 mersenne_twister_engine (result_type sd=default_seed)
 
void seed (result_type sd=default_seed)
 
result_type operator() ()
 
void discard (unsigned long long z)
 
result_type last ()
 

Öffentliche, statische Methoden

static constexpr result_type min ()
 
static constexpr result_type max ()
 

Statische öffentliche Attribute

static constexpr size_t word_size = w
 
static constexpr size_t state_size = n
 
static constexpr size_t shift_size = m
 
static constexpr size_t mask_bits = r
 
static constexpr result_type xor_mask = a
 
static constexpr size_t tempering_u = u
 
static constexpr result_type tempering_d = d
 
static constexpr size_t tempering_s = s
 
static constexpr result_type tempering_b = b
 
static constexpr size_t tempering_t = t
 
static constexpr result_type tempering_c = c
 
static constexpr size_t tempering_l = l
 
static constexpr result_type initialization_multiplier = f
 
static constexpr size_t MASK_LOWER = (1ull << mask_bits) - 1
 
static constexpr size_t MASK_UPPER = (1ull << mask_bits)
 
static constexpr result_type default_seed = 5489u
 

Ausführliche Beschreibung

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 >

Dokumentation der benutzerdefinierten Datentypen

◆ result_type

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>
using std::mersenne_twister_engine< UIntType, w, n, m, r, a, u, d, s, b, t, c, l, f >::result_type = UIntType

Beschreibung der Konstruktoren und Destruktoren

◆ mersenne_twister_engine()

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>
std::mersenne_twister_engine< UIntType, w, n, m, r, a, u, d, s, b, t, c, l, f >::mersenne_twister_engine ( result_type  sd = default_seed)
inlineexplicit
62  {
63  seed(sd);
64  }
void seed(result_type sd=default_seed)
Definition: mersenne_twister_engine.hpp:65

Dokumentation der Elementfunktionen

◆ discard()

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
90  {
91  for (; z != 0ULL; --z)
92  (*this).operator ()();
93  }

◆ last()

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>
result_type std::mersenne_twister_engine< UIntType, w, n, m, r, a, u, d, s, b, t, c, l, f >::last ( )
inline
94  {
95  return m_y;
96  }

◆ max()

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 ( )
inlinestatic
98 { return 2 ^ word_size - 1; }
static constexpr size_t word_size
Definition: mersenne_twister_engine.hpp:45

◆ min()

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 ( )
inlinestatic
97 { return 0; }

◆ operator()()

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>
result_type std::mersenne_twister_engine< UIntType, w, n, m, r, a, u, d, s, b, t, c, l, f >::operator() ( )
inline
72  {
73  uint32_t y;
74  int i = m_index;
75  if ( m_index >= state_size ) {
76  twist();
77  i = m_index;
78  }
79  y = m_state[i];
80  m_index = i + 1;
81 
82  y ^= (m_state[i] >> tempering_u);
83  y ^= (y << tempering_s) & tempering_b;
84  y ^= (y << tempering_t) & tempering_c;
85  y ^= (y >> tempering_l);
86 
87  m_y = y;
88  return y;
89  }
static constexpr size_t tempering_u
Definition: mersenne_twister_engine.hpp:50
static constexpr size_t state_size
Definition: mersenne_twister_engine.hpp:46
static constexpr size_t tempering_s
Definition: mersenne_twister_engine.hpp:52
static constexpr size_t tempering_t
Definition: mersenne_twister_engine.hpp:54
static constexpr result_type tempering_c
Definition: mersenne_twister_engine.hpp:55
static constexpr result_type tempering_b
Definition: mersenne_twister_engine.hpp:53
static constexpr size_t tempering_l
Definition: mersenne_twister_engine.hpp:56

◆ seed()

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 >::seed ( result_type  sd = default_seed)
inline
65  {
66  m_state[0] = seed;
67  m_index = state_size;
68  for (uint32_t i = 1; i < state_size; i++ ) {
69  m_state[i] = (initialization_multiplier * (m_state[i - 1] ^ (m_state[i - 1] >> 30)) + i);
70  }
71  }
static constexpr size_t state_size
Definition: mersenne_twister_engine.hpp:46
void seed(result_type sd=default_seed)
Definition: mersenne_twister_engine.hpp:65
static constexpr result_type initialization_multiplier
Definition: mersenne_twister_engine.hpp:57

Dokumentation der Datenelemente

◆ default_seed

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>
constexpr result_type std::mersenne_twister_engine< UIntType, w, n, m, r, a, u, d, s, b, t, c, l, f >::default_seed = 5489u
static

◆ initialization_multiplier

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>
constexpr result_type std::mersenne_twister_engine< UIntType, w, n, m, r, a, u, d, s, b, t, c, l, f >::initialization_multiplier = f
static

◆ mask_bits

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>
constexpr size_t std::mersenne_twister_engine< UIntType, w, n, m, r, a, u, d, s, b, t, c, l, f >::mask_bits = r
static

◆ MASK_LOWER

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>
constexpr size_t std::mersenne_twister_engine< UIntType, w, n, m, r, a, u, d, s, b, t, c, l, f >::MASK_LOWER = (1ull << mask_bits) - 1
static

◆ MASK_UPPER

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>
constexpr size_t std::mersenne_twister_engine< UIntType, w, n, m, r, a, u, d, s, b, t, c, l, f >::MASK_UPPER = (1ull << mask_bits)
static

◆ shift_size

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>
constexpr size_t std::mersenne_twister_engine< UIntType, w, n, m, r, a, u, d, s, b, t, c, l, f >::shift_size = m
static

◆ state_size

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>
constexpr size_t std::mersenne_twister_engine< UIntType, w, n, m, r, a, u, d, s, b, t, c, l, f >::state_size = n
static

◆ tempering_b

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>
constexpr result_type std::mersenne_twister_engine< UIntType, w, n, m, r, a, u, d, s, b, t, c, l, f >::tempering_b = b
static

◆ tempering_c

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>
constexpr result_type std::mersenne_twister_engine< UIntType, w, n, m, r, a, u, d, s, b, t, c, l, f >::tempering_c = c
static

◆ tempering_d

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>
constexpr result_type std::mersenne_twister_engine< UIntType, w, n, m, r, a, u, d, s, b, t, c, l, f >::tempering_d = d
static

◆ tempering_l

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>
constexpr size_t std::mersenne_twister_engine< UIntType, w, n, m, r, a, u, d, s, b, t, c, l, f >::tempering_l = l
static

◆ tempering_s

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>
constexpr size_t std::mersenne_twister_engine< UIntType, w, n, m, r, a, u, d, s, b, t, c, l, f >::tempering_s = s
static

◆ tempering_t

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>
constexpr size_t std::mersenne_twister_engine< UIntType, w, n, m, r, a, u, d, s, b, t, c, l, f >::tempering_t = t
static

◆ tempering_u

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>
constexpr size_t std::mersenne_twister_engine< UIntType, w, n, m, r, a, u, d, s, b, t, c, l, f >::tempering_u = u
static

◆ word_size

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>
constexpr size_t std::mersenne_twister_engine< UIntType, w, n, m, r, a, u, d, s, b, t, c, l, f >::word_size = w
static

◆ xor_mask

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>
constexpr result_type std::mersenne_twister_engine< UIntType, w, n, m, r, a, u, d, s, b, t, c, l, f >::xor_mask = a
static

Die Dokumentation für diese Klasse wurde erzeugt aufgrund der Datei: