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// void discard(unsigned long long z);
17
18#include <random>
19#include <cassert>
20
21#include "test_macros.h"
22
23void
24test1()
25{
26 std::mt19937 e1;
27 std::mt19937 e2 = e1;
28 assert(e1 == e2);
29 e1.discard(z: 3);
30 assert(e1 != e2);
31 (void)e2();
32 (void)e2();
33 (void)e2();
34 assert(e1 == e2);
35}
36
37void
38test2()
39{
40 std::mt19937_64 e1;
41 std::mt19937_64 e2 = e1;
42 assert(e1 == e2);
43 e1.discard(z: 3);
44 assert(e1 != e2);
45 (void)e2();
46 (void)e2();
47 (void)e2();
48 assert(e1 == e2);
49}
50
51int main(int, char**)
52{
53 test1();
54 test2();
55
56 return 0;
57}
58

source code of libcxx/test/std/numerics/rand/rand.eng/rand.eng.mers/discard.pass.cpp