Home | History | Annotate | Download | only in rand.dist.bern.bernoulli
      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 // class bernoulli_distribution
     13 
     14 // template <class charT, class traits>
     15 // basic_ostream<charT, traits>&
     16 // operator<<(basic_ostream<charT, traits>& os,
     17 //            const bernoulli_distribution& x);
     18 //
     19 // template <class charT, class traits>
     20 // basic_istream<charT, traits>&
     21 // operator>>(basic_istream<charT, traits>& is,
     22 //            bernoulli_distribution& x);
     23 
     24 #include <random>
     25 #include <sstream>
     26 #include <cassert>
     27 
     28 int main()
     29 {
     30     {
     31         typedef std::bernoulli_distribution D;
     32         D d1(.25);
     33         std::ostringstream os;
     34         os << d1;
     35         std::istringstream is(os.str());
     36         D d2;
     37         is >> d2;
     38         assert(d1 == d2);
     39     }
     40 }
     41