tmp/tmptzybsje3/{from.md → to.md}
RENAMED
|
@@ -10,27 +10,26 @@ values b distributed according to the discrete probability function $$%
|
|
| 10 |
1-p & \mbox{if} & b = \tcode{false}
|
| 11 |
\end{array}\right.
|
| 12 |
\; \mbox{.}$$
|
| 13 |
|
| 14 |
``` cpp
|
| 15 |
-
class bernoulli_distribution
|
| 16 |
-
{
|
| 17 |
public:
|
| 18 |
// types
|
| 19 |
-
|
| 20 |
-
|
| 21 |
|
| 22 |
// constructors and reset functions
|
| 23 |
explicit bernoulli_distribution(double p = 0.5);
|
| 24 |
explicit bernoulli_distribution(const param_type& parm);
|
| 25 |
void reset();
|
| 26 |
|
| 27 |
// generating functions
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
|
| 33 |
// property functions
|
| 34 |
double p() const;
|
| 35 |
param_type param() const;
|
| 36 |
void param(const param_type& parm);
|
|
@@ -64,27 +63,26 @@ $$%
|
|
| 64 |
= \binom{t}{i} \cdot p^i \cdot (1-p)^{t-i}
|
| 65 |
\; \mbox{.}$$
|
| 66 |
|
| 67 |
``` cpp
|
| 68 |
template<class IntType = int>
|
| 69 |
-
|
| 70 |
-
{
|
| 71 |
public:
|
| 72 |
// types
|
| 73 |
-
|
| 74 |
-
|
| 75 |
|
| 76 |
// constructors and reset functions
|
| 77 |
explicit binomial_distribution(IntType t = 1, double p = 0.5);
|
| 78 |
explicit binomial_distribution(const param_type& parm);
|
| 79 |
void reset();
|
| 80 |
|
| 81 |
// generating functions
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
|
| 87 |
// property functions
|
| 88 |
IntType t() const;
|
| 89 |
double p() const;
|
| 90 |
param_type param() const;
|
|
@@ -126,27 +124,26 @@ $$%
|
|
| 126 |
= p \cdot (1-p)^{i}
|
| 127 |
\; \mbox{.}$$
|
| 128 |
|
| 129 |
``` cpp
|
| 130 |
template<class IntType = int>
|
| 131 |
-
|
| 132 |
-
{
|
| 133 |
public:
|
| 134 |
// types
|
| 135 |
-
|
| 136 |
-
|
| 137 |
|
| 138 |
// constructors and reset functions
|
| 139 |
explicit geometric_distribution(double p = 0.5);
|
| 140 |
explicit geometric_distribution(const param_type& parm);
|
| 141 |
void reset();
|
| 142 |
|
| 143 |
// generating functions
|
| 144 |
-
|
| 145 |
-
|
| 146 |
-
|
| 147 |
-
|
| 148 |
|
| 149 |
// property functions
|
| 150 |
double p() const;
|
| 151 |
param_type param() const;
|
| 152 |
void param(const param_type& parm);
|
|
@@ -178,29 +175,31 @@ random integers i ≥ 0 distributed according to the discrete probability
|
|
| 178 |
function $$%
|
| 179 |
P(i\,|\,k,p)
|
| 180 |
= \binom{k+i-1}{i} \cdot p^k \cdot (1-p)^i
|
| 181 |
\; \mbox{.}$$
|
| 182 |
|
|
|
|
|
|
|
|
|
|
| 183 |
``` cpp
|
| 184 |
template<class IntType = int>
|
| 185 |
-
|
| 186 |
-
{
|
| 187 |
public:
|
| 188 |
// types
|
| 189 |
-
|
| 190 |
-
|
| 191 |
|
| 192 |
// constructor and reset functions
|
| 193 |
explicit negative_binomial_distribution(IntType k = 1, double p = 0.5);
|
| 194 |
explicit negative_binomial_distribution(const param_type& parm);
|
| 195 |
void reset();
|
| 196 |
|
| 197 |
// generating functions
|
| 198 |
-
|
| 199 |
-
|
| 200 |
-
|
| 201 |
-
|
| 202 |
|
| 203 |
// property functions
|
| 204 |
IntType k() const;
|
| 205 |
double p() const;
|
| 206 |
param_type param() const;
|
|
|
|
| 10 |
1-p & \mbox{if} & b = \tcode{false}
|
| 11 |
\end{array}\right.
|
| 12 |
\; \mbox{.}$$
|
| 13 |
|
| 14 |
``` cpp
|
| 15 |
+
class bernoulli_distribution {
|
|
|
|
| 16 |
public:
|
| 17 |
// types
|
| 18 |
+
using result_type = bool;
|
| 19 |
+
using param_type = unspecified;
|
| 20 |
|
| 21 |
// constructors and reset functions
|
| 22 |
explicit bernoulli_distribution(double p = 0.5);
|
| 23 |
explicit bernoulli_distribution(const param_type& parm);
|
| 24 |
void reset();
|
| 25 |
|
| 26 |
// generating functions
|
| 27 |
+
template<class URBG>
|
| 28 |
+
result_type operator()(URBG& g);
|
| 29 |
+
template<class URBG>
|
| 30 |
+
result_type operator()(URBG& g, const param_type& parm);
|
| 31 |
|
| 32 |
// property functions
|
| 33 |
double p() const;
|
| 34 |
param_type param() const;
|
| 35 |
void param(const param_type& parm);
|
|
|
|
| 63 |
= \binom{t}{i} \cdot p^i \cdot (1-p)^{t-i}
|
| 64 |
\; \mbox{.}$$
|
| 65 |
|
| 66 |
``` cpp
|
| 67 |
template<class IntType = int>
|
| 68 |
+
class binomial_distribution {
|
|
|
|
| 69 |
public:
|
| 70 |
// types
|
| 71 |
+
using result_type = IntType;
|
| 72 |
+
using param_type = unspecified;
|
| 73 |
|
| 74 |
// constructors and reset functions
|
| 75 |
explicit binomial_distribution(IntType t = 1, double p = 0.5);
|
| 76 |
explicit binomial_distribution(const param_type& parm);
|
| 77 |
void reset();
|
| 78 |
|
| 79 |
// generating functions
|
| 80 |
+
template<class URBG>
|
| 81 |
+
result_type operator()(URBG& g);
|
| 82 |
+
template<class URBG>
|
| 83 |
+
result_type operator()(URBG& g, const param_type& parm);
|
| 84 |
|
| 85 |
// property functions
|
| 86 |
IntType t() const;
|
| 87 |
double p() const;
|
| 88 |
param_type param() const;
|
|
|
|
| 124 |
= p \cdot (1-p)^{i}
|
| 125 |
\; \mbox{.}$$
|
| 126 |
|
| 127 |
``` cpp
|
| 128 |
template<class IntType = int>
|
| 129 |
+
class geometric_distribution {
|
|
|
|
| 130 |
public:
|
| 131 |
// types
|
| 132 |
+
using result_type = IntType;
|
| 133 |
+
using param_type = unspecified;
|
| 134 |
|
| 135 |
// constructors and reset functions
|
| 136 |
explicit geometric_distribution(double p = 0.5);
|
| 137 |
explicit geometric_distribution(const param_type& parm);
|
| 138 |
void reset();
|
| 139 |
|
| 140 |
// generating functions
|
| 141 |
+
template<class URBG>
|
| 142 |
+
result_type operator()(URBG& g);
|
| 143 |
+
template<class URBG>
|
| 144 |
+
result_type operator()(URBG& g, const param_type& parm);
|
| 145 |
|
| 146 |
// property functions
|
| 147 |
double p() const;
|
| 148 |
param_type param() const;
|
| 149 |
void param(const param_type& parm);
|
|
|
|
| 175 |
function $$%
|
| 176 |
P(i\,|\,k,p)
|
| 177 |
= \binom{k+i-1}{i} \cdot p^k \cdot (1-p)^i
|
| 178 |
\; \mbox{.}$$
|
| 179 |
|
| 180 |
+
[*Note 1*: This implies that P(i | k,p) is undefined when
|
| 181 |
+
`p == 1`. — *end note*]
|
| 182 |
+
|
| 183 |
``` cpp
|
| 184 |
template<class IntType = int>
|
| 185 |
+
class negative_binomial_distribution {
|
|
|
|
| 186 |
public:
|
| 187 |
// types
|
| 188 |
+
using result_type = IntType;
|
| 189 |
+
using param_type = unspecified;
|
| 190 |
|
| 191 |
// constructor and reset functions
|
| 192 |
explicit negative_binomial_distribution(IntType k = 1, double p = 0.5);
|
| 193 |
explicit negative_binomial_distribution(const param_type& parm);
|
| 194 |
void reset();
|
| 195 |
|
| 196 |
// generating functions
|
| 197 |
+
template<class URBG>
|
| 198 |
+
result_type operator()(URBG& g);
|
| 199 |
+
template<class URBG>
|
| 200 |
+
result_type operator()(URBG& g, const param_type& parm);
|
| 201 |
|
| 202 |
// property functions
|
| 203 |
IntType k() const;
|
| 204 |
double p() const;
|
| 205 |
param_type param() const;
|