Home | History | Annotate | Download | only in rand.dist.samp.discrete
      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 IntType = int>
     13 // class discrete_distribution
     14 
     15 // bool operator=(const discrete_distribution& x,
     16 //                const discrete_distribution& y);
     17 // bool operator!(const discrete_distribution& x,
     18 //                const discrete_distribution& y);
     19 
     20 #include <random>
     21 #include <cassert>
     22 
     23 int main()
     24 {
     25     {
     26         typedef std::discrete_distribution<> D;
     27         D d1;
     28         D d2;
     29         assert(d1 == d2);
     30     }
     31     {
     32         typedef std::discrete_distribution<> D;
     33         double p0[] = {1};
     34         D d1(p0, p0+1);
     35         D d2;
     36         assert(d1 == d2);
     37     }
     38     {
     39         typedef std::discrete_distribution<> D;
     40         double p0[] = {10, 30};
     41         D d1(p0, p0+2);
     42         D d2;
     43         assert(d1 != d2);
     44     }
     45 }
     46