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 | // explicit mersenne_twister_engine(); |
17 | |
18 | #include <random> |
19 | #include <cassert> |
20 | |
21 | #include "test_macros.h" |
22 | |
23 | void |
24 | test1() |
25 | { |
26 | std::mt19937 e1; |
27 | std::mt19937 e2(std::mt19937::default_seed); |
28 | assert(e1 == e2); |
29 | assert(e1() == 3499211612u); |
30 | } |
31 | |
32 | void |
33 | test2() |
34 | { |
35 | std::mt19937_64 e1; |
36 | std::mt19937_64 e2(std::mt19937_64::default_seed); |
37 | assert(e1 == e2); |
38 | assert(e1() == 14514284786278117030ull); |
39 | } |
40 | |
41 | int main(int, char**) |
42 | { |
43 | test1(); |
44 | test2(); |
45 | |
46 | return 0; |
47 | } |
48 | |