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 // template<class Sseq> explicit subtract_with_carry_engine(Sseq& q);
16 
17 #include <random>
18 #include <sstream>
19 #include <cassert>
20 
21 void
test1()22 test1()
23 {
24     const char* a = "13604817 711567 9760686 13278398 3323440 175548 5553651 "
25     "3028863 10748297 2216688 275779 14778841 14438394 9483441 4229545 "
26     "14657301 12636508 15978210 1653340 1718567 9272421 14302862 7940348 "
27     "889045 0";
28     unsigned as[] = {3, 5, 7};
29     std::seed_seq sseq(as, as+3);
30     std::ranlux24_base e1(sseq);
31     std::ostringstream os;
32     os << e1;
33     assert(os.str() == a);
34 }
35 
36 void
test2()37 test2()
38 {
39     const char* a = "241408498702289 172342669275054 191026374555184 "
40     "61020585639411 231929771458953 142769679250755 198672786411514 "
41     "183712717244841 227473912549724 62843577252444 68782400568421 "
42     "159248704678140 0";
43     unsigned as[] = {3, 5, 7};
44     std::seed_seq sseq(as, as+3);
45     std::ranlux48_base e1(sseq);
46     std::ostringstream os;
47     os << e1;
48     assert(os.str() == a);
49 }
50 
main()51 int main()
52 {
53     test1();
54     test2();
55 }
56