blob: 28ebdf23d0cb55b4fb9ac910dfc62f061f977677 [file] [log] [blame]
Howard Hinnant3e519522010-05-11 19:42:16 +00001//===----------------------------------------------------------------------===//
2//
Howard Hinnant5b08a8a2010-05-11 21:36:01 +00003// The LLVM Compiler Infrastructure
Howard Hinnant3e519522010-05-11 19:42:16 +00004//
Howard Hinnant412dbeb2010-11-16 22:09:02 +00005// This file is dual licensed under the MIT and the University of Illinois Open
6// Source Licenses. See LICENSE.TXT for details.
Howard Hinnant3e519522010-05-11 19:42:16 +00007//
8//===----------------------------------------------------------------------===//
9
10// <random>
11
12// template <class UIntType, UIntType a, UIntType c, UIntType m>
13// class linear_congruential_engine;
14
15// template <class charT, class traits,
16// class UIntType, UIntType a, UIntType c, UIntType m>
17// basic_ostream<charT, traits>&
18// operator<<(basic_ostream<charT, traits>& os,
19// const linear_congruential_engine<UIntType, a, c, m>& x);
Howard Hinnanta0eaf602010-08-22 00:42:21 +000020//
Howard Hinnant3e519522010-05-11 19:42:16 +000021// template <class charT, class traits,
22// class UIntType, UIntType a, UIntType c, UIntType m>
23// basic_istream<charT, traits>&
24// operator>>(basic_istream<charT, traits>& is,
25// linear_congruential_engine<UIntType, a, c, m>& x);
26
27#include <random>
28#include <sstream>
29#include <cassert>
30
31int main()
32{
33 {
34 typedef std::linear_congruential_engine<unsigned, 48271, 0, 2147483647> E;
35 E e1;
36 e1.discard(100);
37 std::ostringstream os;
38 os << e1;
39 std::istringstream is(os.str());
40 E e2;
41 is >> e2;
42 assert(e1 == e2);
43 }
44}