• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //===----------------------------------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 // <random>
10 
11 // template <class UIntType, size_t w, size_t n, size_t m, size_t r,
12 //           UIntType a, size_t u, UIntType d, size_t s,
13 //           UIntType b, size_t t, UIntType c, size_t l, UIntType f>
14 // class mersenne_twister_engine;
15 
16 // mersenne_twister_engine& operator=(const mersenne_twister_engine&);
17 
18 #include <random>
19 #include <cassert>
20 
21 #include "test_macros.h"
22 
23 void
test1()24 test1()
25 {
26     typedef std::mt19937 E;
27     E e1(2);
28     (void)e1();
29     E e2(5);
30     e2 = e1;
31     assert(e1 == e2);
32     assert(e1() == e2());
33     E::result_type k = e1();
34     assert(e1 != e2);
35     assert(e2() == k);
36     assert(e1 == e2);
37 }
38 
39 void
test2()40 test2()
41 {
42     typedef std::mt19937_64 E;
43     E e1(3);
44     (void)e1();
45     E e2(5);
46     e2 = e1;
47     assert(e1 == e2);
48     assert(e1() == e2());
49     E::result_type k = e1();
50     assert(e1 != e2);
51     assert(e2() == k);
52     assert(e1 == e2);
53 }
54 
main(int,char **)55 int main(int, char**)
56 {
57     test1();
58     test2();
59 
60   return 0;
61 }
62