| 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 | // explicit independent_bits_engine(); |
| 15 | |
| 16 | #include <random> |
| 17 | #include <cassert> |
| 18 | |
| 19 | #include "test_macros.h" |
| 20 | |
| 21 | void |
| 22 | test1() |
| 23 | { |
| 24 | std::independent_bits_engine<std::ranlux24, 32, unsigned> e1; |
| 25 | std::independent_bits_engine<std::ranlux24, 32, unsigned> e2(std::ranlux24_base::default_seed); |
| 26 | assert(e1 == e2); |
| 27 | assert(e1() == 2066486613); |
| 28 | } |
| 29 | |
| 30 | void |
| 31 | test2() |
| 32 | { |
| 33 | std::independent_bits_engine<std::ranlux48, 64, unsigned long long> e1; |
| 34 | std::independent_bits_engine<std::ranlux48, 64, unsigned long long> e2(std::ranlux48_base::default_seed); |
| 35 | assert(e1 == e2); |
| 36 | assert(e1() == 18223106896348967647ull); |
| 37 | } |
| 38 | |
| 39 | int main(int, char**) |
| 40 | { |
| 41 | test1(); |
| 42 | test2(); |
| 43 | |
| 44 | return 0; |
| 45 | } |
| 46 | |