tmp/tmp9zpmve3b/{from.md → to.md}
RENAMED
|
@@ -8,10 +8,11 @@ $$P(b\,|\,p) = \left\{ \begin{array}{ll}
|
|
| 8 |
p & \text{ if $b = \tcode{true}$, or} \\
|
| 9 |
1 - p & \text{ if $b = \tcode{false}$.}
|
| 10 |
\end{array}\right.$$
|
| 11 |
|
| 12 |
``` cpp
|
|
|
|
| 13 |
class bernoulli_distribution {
|
| 14 |
public:
|
| 15 |
// types
|
| 16 |
using result_type = bool;
|
| 17 |
using param_type = unspecified;
|
|
@@ -20,10 +21,13 @@ public:
|
|
| 20 |
bernoulli_distribution() : bernoulli_distribution(0.5) {}
|
| 21 |
explicit bernoulli_distribution(double p);
|
| 22 |
explicit bernoulli_distribution(const param_type& parm);
|
| 23 |
void reset();
|
| 24 |
|
|
|
|
|
|
|
|
|
|
| 25 |
// generating functions
|
| 26 |
template<class URBG>
|
| 27 |
result_type operator()(URBG& g);
|
| 28 |
template<class URBG>
|
| 29 |
result_type operator()(URBG& g, const param_type& parm);
|
|
@@ -32,11 +36,20 @@ public:
|
|
| 32 |
double p() const;
|
| 33 |
param_type param() const;
|
| 34 |
void param(const param_type& parm);
|
| 35 |
result_type min() const;
|
| 36 |
result_type max() const;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 37 |
};
|
|
|
|
| 38 |
```
|
| 39 |
|
| 40 |
``` cpp
|
| 41 |
explicit bernoulli_distribution(double p);
|
| 42 |
```
|
|
@@ -57,10 +70,11 @@ constructed.
|
|
| 57 |
A `binomial_distribution` random number distribution produces integer
|
| 58 |
values i ≥ 0 distributed according to the discrete probability function
|
| 59 |
$$P(i\,|\,t,p) = \binom{t}{i} \cdot p^i \cdot (1-p)^{t-i} \text{ .}$$
|
| 60 |
|
| 61 |
``` cpp
|
|
|
|
| 62 |
template<class IntType = int>
|
| 63 |
class binomial_distribution {
|
| 64 |
public:
|
| 65 |
// types
|
| 66 |
using result_type = IntType;
|
|
@@ -70,10 +84,13 @@ template<class IntType = int>
|
|
| 70 |
binomial_distribution() : binomial_distribution(1) {}
|
| 71 |
explicit binomial_distribution(IntType t, double p = 0.5);
|
| 72 |
explicit binomial_distribution(const param_type& parm);
|
| 73 |
void reset();
|
| 74 |
|
|
|
|
|
|
|
|
|
|
| 75 |
// generating functions
|
| 76 |
template<class URBG>
|
| 77 |
result_type operator()(URBG& g);
|
| 78 |
template<class URBG>
|
| 79 |
result_type operator()(URBG& g, const param_type& parm);
|
|
@@ -83,11 +100,20 @@ template<class IntType = int>
|
|
| 83 |
double p() const;
|
| 84 |
param_type param() const;
|
| 85 |
void param(const param_type& parm);
|
| 86 |
result_type min() const;
|
| 87 |
result_type max() const;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 88 |
};
|
|
|
|
| 89 |
```
|
| 90 |
|
| 91 |
``` cpp
|
| 92 |
explicit binomial_distribution(IntType t, double p = 0.5);
|
| 93 |
```
|
|
@@ -116,10 +142,11 @@ constructed.
|
|
| 116 |
A `geometric_distribution` random number distribution produces integer
|
| 117 |
values i ≥ 0 distributed according to the discrete probability function
|
| 118 |
$$P(i\,|\,p) = p \cdot (1-p)^{i} \text{ .}$$
|
| 119 |
|
| 120 |
``` cpp
|
|
|
|
| 121 |
template<class IntType = int>
|
| 122 |
class geometric_distribution {
|
| 123 |
public:
|
| 124 |
// types
|
| 125 |
using result_type = IntType;
|
|
@@ -129,10 +156,13 @@ template<class IntType = int>
|
|
| 129 |
geometric_distribution() : geometric_distribution(0.5) {}
|
| 130 |
explicit geometric_distribution(double p);
|
| 131 |
explicit geometric_distribution(const param_type& parm);
|
| 132 |
void reset();
|
| 133 |
|
|
|
|
|
|
|
|
|
|
| 134 |
// generating functions
|
| 135 |
template<class URBG>
|
| 136 |
result_type operator()(URBG& g);
|
| 137 |
template<class URBG>
|
| 138 |
result_type operator()(URBG& g, const param_type& parm);
|
|
@@ -141,11 +171,20 @@ template<class IntType = int>
|
|
| 141 |
double p() const;
|
| 142 |
param_type param() const;
|
| 143 |
void param(const param_type& parm);
|
| 144 |
result_type min() const;
|
| 145 |
result_type max() const;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 146 |
};
|
|
|
|
| 147 |
```
|
| 148 |
|
| 149 |
``` cpp
|
| 150 |
explicit geometric_distribution(double p);
|
| 151 |
```
|
|
@@ -170,10 +209,11 @@ $$P(i\,|\,k,p) = \binom{k+i-1}{i} \cdot p^k \cdot (1-p)^i \text{ .}$$
|
|
| 170 |
|
| 171 |
[*Note 1*: This implies that P(i | k,p) is undefined when
|
| 172 |
`p == 1`. — *end note*]
|
| 173 |
|
| 174 |
``` cpp
|
|
|
|
| 175 |
template<class IntType = int>
|
| 176 |
class negative_binomial_distribution {
|
| 177 |
public:
|
| 178 |
// types
|
| 179 |
using result_type = IntType;
|
|
@@ -183,10 +223,14 @@ template<class IntType = int>
|
|
| 183 |
negative_binomial_distribution() : negative_binomial_distribution(1) {}
|
| 184 |
explicit negative_binomial_distribution(IntType k, double p = 0.5);
|
| 185 |
explicit negative_binomial_distribution(const param_type& parm);
|
| 186 |
void reset();
|
| 187 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 188 |
// generating functions
|
| 189 |
template<class URBG>
|
| 190 |
result_type operator()(URBG& g);
|
| 191 |
template<class URBG>
|
| 192 |
result_type operator()(URBG& g, const param_type& parm);
|
|
@@ -196,11 +240,20 @@ template<class IntType = int>
|
|
| 196 |
double p() const;
|
| 197 |
param_type param() const;
|
| 198 |
void param(const param_type& parm);
|
| 199 |
result_type min() const;
|
| 200 |
result_type max() const;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 201 |
};
|
|
|
|
| 202 |
```
|
| 203 |
|
| 204 |
``` cpp
|
| 205 |
explicit negative_binomial_distribution(IntType k, double p = 0.5);
|
| 206 |
```
|
|
|
|
| 8 |
p & \text{ if $b = \tcode{true}$, or} \\
|
| 9 |
1 - p & \text{ if $b = \tcode{false}$.}
|
| 10 |
\end{array}\right.$$
|
| 11 |
|
| 12 |
``` cpp
|
| 13 |
+
namespace std {
|
| 14 |
class bernoulli_distribution {
|
| 15 |
public:
|
| 16 |
// types
|
| 17 |
using result_type = bool;
|
| 18 |
using param_type = unspecified;
|
|
|
|
| 21 |
bernoulli_distribution() : bernoulli_distribution(0.5) {}
|
| 22 |
explicit bernoulli_distribution(double p);
|
| 23 |
explicit bernoulli_distribution(const param_type& parm);
|
| 24 |
void reset();
|
| 25 |
|
| 26 |
+
// equality operators
|
| 27 |
+
friend bool operator==(const bernoulli_distribution& x, const bernoulli_distribution& y);
|
| 28 |
+
|
| 29 |
// generating functions
|
| 30 |
template<class URBG>
|
| 31 |
result_type operator()(URBG& g);
|
| 32 |
template<class URBG>
|
| 33 |
result_type operator()(URBG& g, const param_type& parm);
|
|
|
|
| 36 |
double p() const;
|
| 37 |
param_type param() const;
|
| 38 |
void param(const param_type& parm);
|
| 39 |
result_type min() const;
|
| 40 |
result_type max() const;
|
| 41 |
+
|
| 42 |
+
// inserters and extractors
|
| 43 |
+
template<class charT, class traits>
|
| 44 |
+
friend basic_ostream<charT, traits>&
|
| 45 |
+
operator<<(basic_ostream<charT, traits>& os, const bernoulli_distribution& x);
|
| 46 |
+
template<class charT, class traits>
|
| 47 |
+
friend basic_istream<charT, traits>&
|
| 48 |
+
operator>>(basic_istream<charT, traits>& is, bernoulli_distribution& x);
|
| 49 |
};
|
| 50 |
+
}
|
| 51 |
```
|
| 52 |
|
| 53 |
``` cpp
|
| 54 |
explicit bernoulli_distribution(double p);
|
| 55 |
```
|
|
|
|
| 70 |
A `binomial_distribution` random number distribution produces integer
|
| 71 |
values i ≥ 0 distributed according to the discrete probability function
|
| 72 |
$$P(i\,|\,t,p) = \binom{t}{i} \cdot p^i \cdot (1-p)^{t-i} \text{ .}$$
|
| 73 |
|
| 74 |
``` cpp
|
| 75 |
+
namespace std {
|
| 76 |
template<class IntType = int>
|
| 77 |
class binomial_distribution {
|
| 78 |
public:
|
| 79 |
// types
|
| 80 |
using result_type = IntType;
|
|
|
|
| 84 |
binomial_distribution() : binomial_distribution(1) {}
|
| 85 |
explicit binomial_distribution(IntType t, double p = 0.5);
|
| 86 |
explicit binomial_distribution(const param_type& parm);
|
| 87 |
void reset();
|
| 88 |
|
| 89 |
+
// equality operators
|
| 90 |
+
friend bool operator==(const binomial_distribution& x, const binomial_distribution& y);
|
| 91 |
+
|
| 92 |
// generating functions
|
| 93 |
template<class URBG>
|
| 94 |
result_type operator()(URBG& g);
|
| 95 |
template<class URBG>
|
| 96 |
result_type operator()(URBG& g, const param_type& parm);
|
|
|
|
| 100 |
double p() const;
|
| 101 |
param_type param() const;
|
| 102 |
void param(const param_type& parm);
|
| 103 |
result_type min() const;
|
| 104 |
result_type max() const;
|
| 105 |
+
|
| 106 |
+
// inserters and extractors
|
| 107 |
+
template<class charT, class traits>
|
| 108 |
+
friend basic_ostream<charT, traits>&
|
| 109 |
+
operator<<(basic_ostream<charT, traits>& os, const binomial_distribution& x);
|
| 110 |
+
template<class charT, class traits>
|
| 111 |
+
friend basic_istream<charT, traits>&
|
| 112 |
+
operator>>(basic_istream<charT, traits>& is, binomial_distribution& x);
|
| 113 |
};
|
| 114 |
+
}
|
| 115 |
```
|
| 116 |
|
| 117 |
``` cpp
|
| 118 |
explicit binomial_distribution(IntType t, double p = 0.5);
|
| 119 |
```
|
|
|
|
| 142 |
A `geometric_distribution` random number distribution produces integer
|
| 143 |
values i ≥ 0 distributed according to the discrete probability function
|
| 144 |
$$P(i\,|\,p) = p \cdot (1-p)^{i} \text{ .}$$
|
| 145 |
|
| 146 |
``` cpp
|
| 147 |
+
namespace std {
|
| 148 |
template<class IntType = int>
|
| 149 |
class geometric_distribution {
|
| 150 |
public:
|
| 151 |
// types
|
| 152 |
using result_type = IntType;
|
|
|
|
| 156 |
geometric_distribution() : geometric_distribution(0.5) {}
|
| 157 |
explicit geometric_distribution(double p);
|
| 158 |
explicit geometric_distribution(const param_type& parm);
|
| 159 |
void reset();
|
| 160 |
|
| 161 |
+
// equality operators
|
| 162 |
+
friend bool operator==(const geometric_distribution& x, const geometric_distribution& y);
|
| 163 |
+
|
| 164 |
// generating functions
|
| 165 |
template<class URBG>
|
| 166 |
result_type operator()(URBG& g);
|
| 167 |
template<class URBG>
|
| 168 |
result_type operator()(URBG& g, const param_type& parm);
|
|
|
|
| 171 |
double p() const;
|
| 172 |
param_type param() const;
|
| 173 |
void param(const param_type& parm);
|
| 174 |
result_type min() const;
|
| 175 |
result_type max() const;
|
| 176 |
+
|
| 177 |
+
// inserters and extractors
|
| 178 |
+
template<class charT, class traits>
|
| 179 |
+
friend basic_ostream<charT, traits>&
|
| 180 |
+
operator<<(basic_ostream<charT, traits>& os, const geometric_distribution& x);
|
| 181 |
+
template<class charT, class traits>
|
| 182 |
+
friend basic_istream<charT, traits>&
|
| 183 |
+
operator>>(basic_istream<charT, traits>& is, geometric_distribution& x);
|
| 184 |
};
|
| 185 |
+
}
|
| 186 |
```
|
| 187 |
|
| 188 |
``` cpp
|
| 189 |
explicit geometric_distribution(double p);
|
| 190 |
```
|
|
|
|
| 209 |
|
| 210 |
[*Note 1*: This implies that P(i | k,p) is undefined when
|
| 211 |
`p == 1`. — *end note*]
|
| 212 |
|
| 213 |
``` cpp
|
| 214 |
+
namespace std {
|
| 215 |
template<class IntType = int>
|
| 216 |
class negative_binomial_distribution {
|
| 217 |
public:
|
| 218 |
// types
|
| 219 |
using result_type = IntType;
|
|
|
|
| 223 |
negative_binomial_distribution() : negative_binomial_distribution(1) {}
|
| 224 |
explicit negative_binomial_distribution(IntType k, double p = 0.5);
|
| 225 |
explicit negative_binomial_distribution(const param_type& parm);
|
| 226 |
void reset();
|
| 227 |
|
| 228 |
+
// equality operators
|
| 229 |
+
friend bool operator==(const negative_binomial_distribution& x,
|
| 230 |
+
const negative_binomial_distribution& y);
|
| 231 |
+
|
| 232 |
// generating functions
|
| 233 |
template<class URBG>
|
| 234 |
result_type operator()(URBG& g);
|
| 235 |
template<class URBG>
|
| 236 |
result_type operator()(URBG& g, const param_type& parm);
|
|
|
|
| 240 |
double p() const;
|
| 241 |
param_type param() const;
|
| 242 |
void param(const param_type& parm);
|
| 243 |
result_type min() const;
|
| 244 |
result_type max() const;
|
| 245 |
+
|
| 246 |
+
// inserters and extractors
|
| 247 |
+
template<class charT, class traits>
|
| 248 |
+
friend basic_ostream<charT, traits>&
|
| 249 |
+
operator<<(basic_ostream<charT, traits>& os, const negative_binomial_distribution& x);
|
| 250 |
+
template<class charT, class traits>
|
| 251 |
+
friend basic_istream<charT, traits>&
|
| 252 |
+
operator>>(basic_istream<charT, traits>& is, negative_binomial_distribution& x);
|
| 253 |
};
|
| 254 |
+
}
|
| 255 |
```
|
| 256 |
|
| 257 |
``` cpp
|
| 258 |
explicit negative_binomial_distribution(IntType k, double p = 0.5);
|
| 259 |
```
|