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