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 <sstream> 20 #include <cassert> 21 22 void 23 test1() 24 { 25 std::mt19937 e1; 26 std::mt19937 e2 = e1; 27 assert(e1 == e2); 28 e1.discard(3); 29 assert(e1 != e2); 30 (void)e2(); 31 (void)e2(); 32 (void)e2(); 33 assert(e1 == e2); 34 } 35 36 void 37 test2() 38 { 39 std::mt19937_64 e1; 40 std::mt19937_64 e2 = e1; 41 assert(e1 == e2); 42 e1.discard(3); 43 assert(e1 != e2); 44 (void)e2(); 45 (void)e2(); 46 (void)e2(); 47 assert(e1 == e2); 48 } 49 50 int main() 51 { 52 test1(); 53 test2(); 54 } 55