Home | History | Annotate | Download | only in rand.adapt.disc
      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 p, size_t r>
     13 // class discard_block_engine
     14 // {
     15 // public:
     16 //     // types
     17 //     typedef typename Engine::result_type result_type;
     18 //
     19 //     // engine characteristics
     20 //     static constexpr size_t block_size = p;
     21 //     static constexpr size_t used_block = r;
     22 //     static constexpr result_type min() { return Engine::min(); }
     23 //     static constexpr result_type max() { return Engine::max(); }
     24 
     25 #include <random>
     26 #include <type_traits>
     27 #include <cassert>
     28 
     29 template <class _Tp>
     30 void where(const _Tp &) {}
     31 
     32 void
     33 test1()
     34 {
     35     typedef std::ranlux24 E;
     36     static_assert((E::block_size == 223), "");
     37     static_assert((E::used_block == 23), "");
     38     /*static_*/assert((E::min() == 0)/*, ""*/);
     39     /*static_*/assert((E::max() == 0xFFFFFF)/*, ""*/);
     40     where(E::block_size);
     41     where(E::used_block);
     42 }
     43 
     44 void
     45 test2()
     46 {
     47     typedef std::ranlux48 E;
     48     static_assert((E::block_size == 389), "");
     49     static_assert((E::used_block == 11), "");
     50     /*static_*/assert((E::min() == 0)/*, ""*/);
     51     /*static_*/assert((E::max() == 0xFFFFFFFFFFFFull)/*, ""*/);
     52     where(E::block_size);
     53     where(E::used_block);
     54 }
     55 
     56 int main()
     57 {
     58     test1();
     59     test2();
     60 }
     61