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 // explicit discard_block_engine(result_type s = default_seed);
     16 
     17 #include <random>
     18 #include <sstream>
     19 #include <cassert>
     20 
     21 void
     22 test1()
     23 {
     24     const char* a = "15136306 8587749 2346244 16479026 15515802 9510553 "
     25     "16090340 14501685 13839944 10789678 11581259 9590790 5840316 5953700 "
     26     "13398366 8134459 16629731 6851902 15583892 1317475 4231148 9092691 "
     27     "5707268 2355175 0 0";
     28     std::ranlux24 e1(0);
     29     std::ostringstream os;
     30     os << e1;
     31     assert(os.str() == a);
     32 }
     33 
     34 void
     35 test2()
     36 {
     37     const char* a = "10880375256626 126660097854724 33643165434010 "
     38     "78293780235492 179418984296008 96783156950859 238199764491708 "
     39     "34339434557790 155299155394531 29014415493780 209265474179052 "
     40     "263777435457028 0 0";
     41     std::ranlux48 e1(0);
     42     std::ostringstream os;
     43     os << e1;
     44     assert(os.str() == a);
     45 }
     46 
     47 int main()
     48 {
     49     test1();
     50     test2();
     51 }
     52