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 // mersenne_twister_engine& operator=(const mersenne_twister_engine&);
18 
19 #include <random>
20 #include <cassert>
21 
22 void
test1()23 test1()
24 {
25     typedef std::mt19937 E;
26     E e1(2);
27     (void)e1();
28     E e2(5);
29     e2 = e1;
30     assert(e1 == e2);
31     assert(e1() == e2());
32     E::result_type k = e1();
33     assert(e1 != e2);
34     assert(e2() == k);
35     assert(e1 == e2);
36 }
37 
38 void
test2()39 test2()
40 {
41     typedef std::mt19937_64 E;
42     E e1(3);
43     (void)e1();
44     E e2(5);
45     e2 = e1;
46     assert(e1 == e2);
47     assert(e1() == e2());
48     E::result_type k = e1();
49     assert(e1 != e2);
50     assert(e2() == k);
51     assert(e1 == e2);
52 }
53 
main()54 int main()
55 {
56     test1();
57     test2();
58 }
59