| 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 Engine, size_t w, class UIntType> |
| 12 | // class independent_bits_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 | void |
| 22 | test1() |
| 23 | { |
| 24 | unsigned a[] = {3, 5, 7}; |
| 25 | std::seed_seq sseq(a, a+3); |
| 26 | std::independent_bits_engine<std::ranlux24, 32, unsigned> e1; |
| 27 | std::independent_bits_engine<std::ranlux24, 32, unsigned> e2(sseq); |
| 28 | assert(e1 != e2); |
| 29 | e1.seed(sseq); |
| 30 | assert(e1 == e2); |
| 31 | } |
| 32 | |
| 33 | void |
| 34 | test2() |
| 35 | { |
| 36 | unsigned a[] = {3, 5, 7}; |
| 37 | std::seed_seq sseq(a, a+3); |
| 38 | std::independent_bits_engine<std::ranlux48, 64, unsigned long long> e1; |
| 39 | std::independent_bits_engine<std::ranlux48, 64, unsigned long long> e2(sseq); |
| 40 | assert(e1 != e2); |
| 41 | e1.seed(q&: sseq); |
| 42 | assert(e1 == e2); |
| 43 | } |
| 44 | |
| 45 | int main(int, char**) |
| 46 | { |
| 47 | test1(); |
| 48 | test2(); |
| 49 | |
| 50 | return 0; |
| 51 | } |
| 52 | |