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 // void discard(unsigned long long z);
18 
19 #include <random>
20 #include <sstream>
21 #include <cassert>
22 
23 void
test1()24 test1()
25 {
26     std::mt19937 e1;
27     std::mt19937 e2 = e1;
28     assert(e1 == e2);
29     e1.discard(3);
30     assert(e1 != e2);
31     e2();
32     e2();
33     e2();
34     assert(e1 == e2);
35 }
36 
37 void
test2()38 test2()
39 {
40     std::mt19937_64 e1;
41     std::mt19937_64 e2 = e1;
42     assert(e1 == e2);
43     e1.discard(3);
44     assert(e1 != e2);
45     e2();
46     e2();
47     e2();
48     assert(e1 == e2);
49 }
50 
main()51 int main()
52 {
53     test1();
54     test2();
55 }
56