Home | History | Annotate | Download | only in rand.adapt.ibits
      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     /*static_*/assert((E::min() == 0)/*, ""*/);
     32     /*static_*/assert((E::max() == 0xFFFFFFFF)/*, ""*/);
     33 }
     34 
     35 void
     36 test2()
     37 {
     38     typedef std::independent_bits_engine<std::ranlux48, 64, unsigned long long> E;
     39     /*static_*/assert((E::min() == 0)/*, ""*/);
     40     /*static_*/assert((E::max() == 0xFFFFFFFFFFFFFFFFull)/*, ""*/);
     41 }
     42 
     43 int main()
     44 {
     45     test1();
     46     test2();
     47 }
     48