1 //===----------------------------------------------------------------------===//
3 // The LLVM Compiler Infrastructure
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
12 // template <class UIntType, size_t w, size_t n, size_t m, size_t r,
13 // UIntType a, size_t u, UIntType d, size_t s,
14 // UIntType b, size_t t,
15 // UIntType c, size_t l, UIntType f>
16 // class mersenne_twister_engine;
18 // template <class Sseq> explicit mersenne_twister_engine(Sseq &q);
20 // [ ... ] Finally, if the most significant $w-r$ bits of $X_{-n}$ are zero,
21 // and if each of the other resulting $X_i$ is $0$, changes $X_{-n}$ to
29 #if TEST_STD_VER >= 11
30 #include <initializer_list>
33 struct all_zero_seed_seq {
34 typedef unsigned int result_type;
36 all_zero_seed_seq() {}
38 template <typename InputIterator>
39 all_zero_seed_seq(InputIterator, InputIterator) {}
40 #if TEST_STD_VER >= 11
41 all_zero_seed_seq(std::initializer_list<result_type>) {}
44 template <typename RandomAccessIterator>
45 void generate(RandomAccessIterator rb, RandomAccessIterator re) {
46 std::fill(rb, re, 0u);
49 std::size_t size() const { return 0u; }
50 template <typename OutputIterator> void param(OutputIterator) const {}
53 template <typename result_type, std::size_t word_size>
55 const std::size_t state_size = 1u;
56 const std::size_t shift_size = 1u;
57 const std::size_t tempering_l = word_size;
60 std::mersenne_twister_engine<result_type, word_size, state_size,
64 0u, 0x0, 0u, 0x0, 0u, 0x0,
69 const result_type Xneg1 = result_type(1) << (word_size - 1);
70 const result_type Y = Xneg1;
71 const result_type X0 = Xneg1 ^ (Y >> 1);
76 // Test for k == 1: word_size <= 32.
77 test<unsigned short, 3u>();
79 // Test for k == 2: (32 < word_size <= 64).
80 test<unsigned long long, 33u>();