1 //===----------------------------------------------------------------------===// 2 // 3 // The LLVM Compiler Infrastructure 4 // 5 // This file is dual licensed under the MIT and the University of Illinois Open 6 // Source Licenses. See LICENSE.TXT for details. 7 // 8 //===----------------------------------------------------------------------===// 9 10 // <random> 11 12 // template <class UIntType, size_t w, size_t n, size_t m, size_t r, 13 // UIntType a, size_t u, UIntType d, size_t s, 14 // UIntType b, size_t t, UIntType c, size_t l, UIntType f> 15 // class mersenne_twister_engine; 16 17 // void seed(result_type s = default_seed); 18 19 #include <random> 20 #include <cassert> 21 22 void 23 test1() 24 { 25 for (int s = 0; s < 20; ++s) 26 { 27 typedef std::mt19937 E; 28 E e1(s); 29 E e2; 30 e2.seed(s); 31 assert(e1 == e2); 32 } 33 } 34 35 void 36 test2() 37 { 38 for (int s = 0; s < 20; ++s) 39 { 40 typedef std::mt19937_64 E; 41 E e1(s); 42 E e2; 43 e2.seed(s); 44 assert(e1 == e2); 45 } 46 } 47 48 int main() 49 { 50 test1(); 51 test2(); 52 } 53