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 s, size_t r> 13// class subtract_with_carry_engine 14// { 15// public: 16// // types 17// typedef UIntType result_type; 18// 19// // engine characteristics 20// static constexpr size_t word_size = w; 21// static constexpr size_t short_lag = s; 22// static constexpr size_t long_lag = r; 23// static constexpr result_type min() { return 0; } 24// static constexpr result_type max() { return m-1; } 25// static constexpr result_type default_seed = 19780503u; 26 27#include <random> 28#include <type_traits> 29#include <cassert> 30 31template <class _Tp> 32void where(const _Tp &) {} 33 34void 35test1() 36{ 37 typedef std::ranlux24_base E; 38 static_assert((E::word_size == 24), ""); 39 static_assert((E::short_lag == 10), ""); 40 static_assert((E::long_lag == 24), ""); 41 /*static_*/assert((E::min() == 0)/*, ""*/); 42 /*static_*/assert((E::max() == 0xFFFFFF)/*, ""*/); 43 static_assert((E::default_seed == 19780503u), ""); 44 where(E::word_size); 45 where(E::short_lag); 46 where(E::long_lag); 47 where(E::default_seed); 48} 49 50void 51test2() 52{ 53 typedef std::ranlux48_base E; 54 static_assert((E::word_size == 48), ""); 55 static_assert((E::short_lag == 5), ""); 56 static_assert((E::long_lag == 12), ""); 57 /*static_*/assert((E::min() == 0)/*, ""*/); 58 /*static_*/assert((E::max() == 0xFFFFFFFFFFFFull)/*, ""*/); 59 static_assert((E::default_seed == 19780503u), ""); 60 where(E::word_size); 61 where(E::short_lag); 62 where(E::long_lag); 63 where(E::default_seed); 64} 65 66int main() 67{ 68 test1(); 69 test2(); 70} 71