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, UIntType a, UIntType c, UIntType m> |
12 | // class linear_congruential_engine; |
13 | |
14 | // template<class Sseq> void seed(Sseq& q); |
15 | |
16 | #include <random> |
17 | #include <cassert> |
18 | |
19 | #include "test_macros.h" |
20 | |
21 | int main(int, char**) |
22 | { |
23 | { |
24 | unsigned a[] = {3, 5, 7}; |
25 | std::seed_seq sseq(a, a+3); |
26 | std::linear_congruential_engine<unsigned, 5, 7, 11> e1; |
27 | std::linear_congruential_engine<unsigned, 5, 7, 11> e2(4); |
28 | assert(e1 != e2); |
29 | e1.seed(sseq); |
30 | assert(e1 == e2); |
31 | } |
32 | { |
33 | unsigned a[] = {3, 5, 7, 9, 11}; |
34 | std::seed_seq sseq(a, a+5); |
35 | typedef std::linear_congruential_engine<unsigned long long, 1, 1, 0x200000001ULL> E; |
36 | E e1(4309005589); |
37 | E e2(sseq); |
38 | assert(e1 == e2); |
39 | } |
40 | |
41 | return 0; |
42 | } |
43 | |