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 Engine, size_t w, class UIntType> 13 // class independent_bits_engine 14 // { 15 // public: 16 // // types 17 // typedef UIntType result_type; 18 // 19 // // engine characteristics 20 // static constexpr result_type min() { return 0; } 21 // static constexpr result_type max() { return 2^w - 1; } 22 23 #include <random> 24 #include <type_traits> 25 #include <cassert> 26 27 void 28 test1() 29 { 30 typedef std::independent_bits_engine<std::ranlux24, 32, unsigned> E; 31 #if TEST_STD_VER >= 11 32 static_assert((E::min() == 0), ""); 33 static_assert((E::max() == 0xFFFFFFFF), ""); 34 #else 35 assert((E::min() == 0)); 36 assert((E::max() == 0xFFFFFFFF)); 37 #endif 38 } 39 40 void 41 test2() 42 { 43 typedef std::independent_bits_engine<std::ranlux48, 64, unsigned long long> E; 44 #if TEST_STD_VER >= 11 45 static_assert((E::min() == 0), ""); 46 static_assert((E::max() == 0xFFFFFFFFFFFFFFFFull), ""); 47 #else 48 assert((E::min() == 0)); 49 assert((E::max() == 0xFFFFFFFFFFFFFFFFull)); 50 #endif 51 } 52 53 int main() 54 { 55 test1(); 56 test2(); 57 } 58