From Jason Turner

[rand.dist.samp.discrete]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmp3iaphmus/{from.md → to.md} +13 -0
tmp/tmp3iaphmus/{from.md → to.md} RENAMED
@@ -9,10 +9,11 @@ as: pₖ = {wₖ / S} for k = 0, …, n - 1, in which the values wₖ, commonly
9
  known as the *weights* , shall be non-negative, non-NaN, and
10
  non-infinity. Moreover, the following relation shall hold:
11
  $0 < S = w_0 + \dotsb + w_{n - 1}$.
12
 
13
  ``` cpp
 
14
  template<class IntType = int>
15
  class discrete_distribution {
16
  public:
17
  // types
18
  using result_type = IntType;
@@ -26,10 +27,13 @@ template<class IntType = int>
26
  template<class UnaryOperation>
27
  discrete_distribution(size_t nw, double xmin, double xmax, UnaryOperation fw);
28
  explicit discrete_distribution(const param_type& parm);
29
  void reset();
30
 
 
 
 
31
  // generating functions
32
  template<class URBG>
33
  result_type operator()(URBG& g);
34
  template<class URBG>
35
  result_type operator()(URBG& g, const param_type& parm);
@@ -38,11 +42,20 @@ template<class IntType = int>
38
  vector<double> probabilities() const;
39
  param_type param() const;
40
  void param(const param_type& parm);
41
  result_type min() const;
42
  result_type max() const;
 
 
 
 
 
 
 
 
43
  };
 
44
  ```
45
 
46
  ``` cpp
47
  discrete_distribution();
48
  ```
 
9
  known as the *weights* , shall be non-negative, non-NaN, and
10
  non-infinity. Moreover, the following relation shall hold:
11
  $0 < S = w_0 + \dotsb + w_{n - 1}$.
12
 
13
  ``` cpp
14
+ namespace std {
15
  template<class IntType = int>
16
  class discrete_distribution {
17
  public:
18
  // types
19
  using result_type = IntType;
 
27
  template<class UnaryOperation>
28
  discrete_distribution(size_t nw, double xmin, double xmax, UnaryOperation fw);
29
  explicit discrete_distribution(const param_type& parm);
30
  void reset();
31
 
32
+ // equality operators
33
+ friend bool operator==(const discrete_distribution& x, const discrete_distribution& y);
34
+
35
  // generating functions
36
  template<class URBG>
37
  result_type operator()(URBG& g);
38
  template<class URBG>
39
  result_type operator()(URBG& g, const param_type& parm);
 
42
  vector<double> probabilities() const;
43
  param_type param() const;
44
  void param(const param_type& parm);
45
  result_type min() const;
46
  result_type max() const;
47
+
48
+ // inserters and extractors
49
+ template<class charT, class traits>
50
+ friend basic_ostream<charT, traits>&
51
+ operator<<(basic_ostream<charT, traits>& os, const discrete_distribution& x);
52
+ template<class charT, class traits>
53
+ friend basic_istream<charT, traits>&
54
+ operator>>(basic_istream<charT, traits>& is, discrete_distribution& x);
55
  };
56
+ }
57
  ```
58
 
59
  ``` cpp
60
  discrete_distribution();
61
  ```