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 // result_type operator()(); 18 19 #include <random> 20 #include <sstream> 21 #include <cassert> 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() 42 { 43 test1(); 44 test2(); 45 } 46