From Jason Turner

[rand.dist.uni]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpz7xu5t20/{from.md → to.md} +27 -0
tmp/tmpz7xu5t20/{from.md → to.md} RENAMED
@@ -5,10 +5,11 @@
5
  A `uniform_int_distribution` random number distribution produces random
6
  integers i, a ≤ i ≤ b, distributed according to the constant discrete
7
  probability function $$P(i\,|\,a,b) = 1 / (b - a + 1) \text{ .}$$
8
 
9
  ``` cpp
 
10
  template<class IntType = int>
11
  class uniform_int_distribution {
12
  public:
13
  // types
14
  using result_type = IntType;
@@ -18,10 +19,13 @@ template<class IntType = int>
18
  uniform_int_distribution() : uniform_int_distribution(0) {}
19
  explicit uniform_int_distribution(IntType a, IntType b = numeric_limits<IntType>::max());
20
  explicit uniform_int_distribution(const param_type& parm);
21
  void reset();
22
 
 
 
 
23
  // generating functions
24
  template<class URBG>
25
  result_type operator()(URBG& g);
26
  template<class URBG>
27
  result_type operator()(URBG& g, const param_type& parm);
@@ -31,11 +35,20 @@ template<class IntType = int>
31
  result_type b() const;
32
  param_type param() const;
33
  void param(const param_type& parm);
34
  result_type min() const;
35
  result_type max() const;
 
 
 
 
 
 
 
 
36
  };
 
37
  ```
38
 
39
  ``` cpp
40
  explicit uniform_int_distribution(IntType a, IntType b = numeric_limits<IntType>::max());
41
  ```
@@ -67,10 +80,11 @@ density function $$p(x\,|\,a,b) = 1 / (b - a) \text{ .}$$
67
 
68
  [*Note 1*: This implies that p(x | a,b) is undefined when
69
  `a == b`. — *end note*]
70
 
71
  ``` cpp
 
72
  template<class RealType = double>
73
  class uniform_real_distribution {
74
  public:
75
  // types
76
  using result_type = RealType;
@@ -80,10 +94,14 @@ template<class RealType = double>
80
  uniform_real_distribution() : uniform_real_distribution(0.0) {}
81
  explicit uniform_real_distribution(RealType a, RealType b = 1.0);
82
  explicit uniform_real_distribution(const param_type& parm);
83
  void reset();
84
 
 
 
 
 
85
  // generating functions
86
  template<class URBG>
87
  result_type operator()(URBG& g);
88
  template<class URBG>
89
  result_type operator()(URBG& g, const param_type& parm);
@@ -93,11 +111,20 @@ template<class RealType = double>
93
  result_type b() const;
94
  param_type param() const;
95
  void param(const param_type& parm);
96
  result_type min() const;
97
  result_type max() const;
 
 
 
 
 
 
 
 
98
  };
 
99
  ```
100
 
101
  ``` cpp
102
  explicit uniform_real_distribution(RealType a, RealType b = 1.0);
103
  ```
 
5
  A `uniform_int_distribution` random number distribution produces random
6
  integers i, a ≤ i ≤ b, distributed according to the constant discrete
7
  probability function $$P(i\,|\,a,b) = 1 / (b - a + 1) \text{ .}$$
8
 
9
  ``` cpp
10
+ namespace std {
11
  template<class IntType = int>
12
  class uniform_int_distribution {
13
  public:
14
  // types
15
  using result_type = IntType;
 
19
  uniform_int_distribution() : uniform_int_distribution(0) {}
20
  explicit uniform_int_distribution(IntType a, IntType b = numeric_limits<IntType>::max());
21
  explicit uniform_int_distribution(const param_type& parm);
22
  void reset();
23
 
24
+ // equality operators
25
+ friend bool operator==(const uniform_int_distribution& x, const uniform_int_distribution& y);
26
+
27
  // generating functions
28
  template<class URBG>
29
  result_type operator()(URBG& g);
30
  template<class URBG>
31
  result_type operator()(URBG& g, const param_type& parm);
 
35
  result_type b() const;
36
  param_type param() const;
37
  void param(const param_type& parm);
38
  result_type min() const;
39
  result_type max() const;
40
+
41
+ // inserters and extractors
42
+ template<class charT, class traits>
43
+ friend basic_ostream<charT, traits>&
44
+ operator<<(basic_ostream<charT, traits>& os, const uniform_int_distribution& x);
45
+ template<class charT, class traits>
46
+ friend basic_istream<charT, traits>&
47
+ operator>>(basic_istream<charT, traits>& is, uniform_int_distribution& x);
48
  };
49
+ }
50
  ```
51
 
52
  ``` cpp
53
  explicit uniform_int_distribution(IntType a, IntType b = numeric_limits<IntType>::max());
54
  ```
 
80
 
81
  [*Note 1*: This implies that p(x | a,b) is undefined when
82
  `a == b`. — *end note*]
83
 
84
  ``` cpp
85
+ namespace std {
86
  template<class RealType = double>
87
  class uniform_real_distribution {
88
  public:
89
  // types
90
  using result_type = RealType;
 
94
  uniform_real_distribution() : uniform_real_distribution(0.0) {}
95
  explicit uniform_real_distribution(RealType a, RealType b = 1.0);
96
  explicit uniform_real_distribution(const param_type& parm);
97
  void reset();
98
 
99
+ // equality operators
100
+ friend bool operator==(const uniform_real_distribution& x,
101
+ const uniform_real_distribution& y);
102
+
103
  // generating functions
104
  template<class URBG>
105
  result_type operator()(URBG& g);
106
  template<class URBG>
107
  result_type operator()(URBG& g, const param_type& parm);
 
111
  result_type b() const;
112
  param_type param() const;
113
  void param(const param_type& parm);
114
  result_type min() const;
115
  result_type max() const;
116
+
117
+ // inserters and extractors
118
+ template<class charT, class traits>
119
+ friend basic_ostream<charT, traits>&
120
+ operator<<(basic_ostream<charT, traits>& os, const uniform_real_distribution& x);
121
+ template<class charT, class traits>
122
+ friend basic_istream<charT, traits>&
123
+ operator>>(basic_istream<charT, traits>& is, uniform_real_distribution& x);
124
  };
125
+ }
126
  ```
127
 
128
  ``` cpp
129
  explicit uniform_real_distribution(RealType a, RealType b = 1.0);
130
  ```