1 //===----------------------------------------------------------------------===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9
10 // <random>
11
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, UIntType c, size_t l, UIntType f>
15 // class mersenne_twister_engine;
16
17 // template<class Sseq> void seed(Sseq& q);
18
19 #include <random>
20 #include <cassert>
21
22 void
test1()23 test1()
24 {
25 unsigned a[] = {3, 5, 7};
26 std::seed_seq sseq(a, a+3);
27 std::mt19937 e1;
28 std::mt19937 e2(sseq);
29 assert(e1 != e2);
30 e1.seed(sseq);
31 assert(e1 == e2);
32 }
33
34 void
test2()35 test2()
36 {
37 unsigned a[] = {3, 5, 7};
38 std::seed_seq sseq(a, a+3);
39 std::mt19937_64 e1;
40 std::mt19937_64 e2(sseq);
41 assert(e1 != e2);
42 e1.seed(sseq);
43 assert(e1 == e2);
44 }
45
main()46 int main()
47 {
48 test1();
49 test2();
50 }
51