1 //===----------------------------------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 // UNSUPPORTED: libcpp-has-no-localization
10 
11 // <random>
12 
13 // template<class IntType = int>
14 // class discrete_distribution
15 
16 // template <class charT, class traits>
17 // basic_ostream<charT, traits>&
18 // operator<<(basic_ostream<charT, traits>& os,
19 //            const discrete_distribution& x);
20 //
21 // template <class charT, class traits>
22 // basic_istream<charT, traits>&
23 // operator>>(basic_istream<charT, traits>& is,
24 //            discrete_distribution& x);
25 
26 #include <random>
27 #include <sstream>
28 #include <cassert>
29 
30 #include "test_macros.h"
31 
main(int,char **)32 int main(int, char**)
33 {
34     {
35         typedef std::discrete_distribution<> D;
36         double p0[] = {.3, .1, .6};
37         D d1(p0, p0+3);
38         std::ostringstream os;
39         os << d1;
40         std::istringstream is(os.str());
41         D d2;
42         is >> d2;
43         assert(d1 == d2);
44     }
45 
46   return 0;
47 }
48