tmp/tmpqsxq552a/{from.md → to.md}
RENAMED
|
@@ -1,24 +1,22 @@
|
|
| 1 |
##### Class template `binomial_distribution` <a id="rand.dist.bern.bin">[[rand.dist.bern.bin]]</a>
|
| 2 |
|
| 3 |
A `binomial_distribution` random number distribution produces integer
|
| 4 |
values i ≥ 0 distributed according to the discrete probability function
|
| 5 |
-
$$
|
| 6 |
-
P(i\,|\,t,p)
|
| 7 |
-
= \binom{t}{i} \cdot p^i \cdot (1-p)^{t-i}
|
| 8 |
-
\; \mbox{.}$$
|
| 9 |
|
| 10 |
``` cpp
|
| 11 |
template<class IntType = int>
|
| 12 |
class binomial_distribution {
|
| 13 |
public:
|
| 14 |
// types
|
| 15 |
using result_type = IntType;
|
| 16 |
using param_type = unspecified;
|
| 17 |
|
| 18 |
// constructors and reset functions
|
| 19 |
-
|
|
|
|
| 20 |
explicit binomial_distribution(const param_type& parm);
|
| 21 |
void reset();
|
| 22 |
|
| 23 |
// generating functions
|
| 24 |
template<class URBG>
|
|
@@ -35,17 +33,17 @@ template<class IntType = int>
|
|
| 35 |
result_type max() const;
|
| 36 |
};
|
| 37 |
```
|
| 38 |
|
| 39 |
``` cpp
|
| 40 |
-
explicit binomial_distribution(IntType t
|
| 41 |
```
|
| 42 |
|
| 43 |
-
*
|
| 44 |
|
| 45 |
-
*
|
| 46 |
-
|
| 47 |
|
| 48 |
``` cpp
|
| 49 |
IntType t() const;
|
| 50 |
```
|
| 51 |
|
|
|
|
| 1 |
##### Class template `binomial_distribution` <a id="rand.dist.bern.bin">[[rand.dist.bern.bin]]</a>
|
| 2 |
|
| 3 |
A `binomial_distribution` random number distribution produces integer
|
| 4 |
values i ≥ 0 distributed according to the discrete probability function
|
| 5 |
+
$$P(i\,|\,t,p) = \binom{t}{i} \cdot p^i \cdot (1-p)^{t-i} \text{ .}$$
|
|
|
|
|
|
|
|
|
|
| 6 |
|
| 7 |
``` cpp
|
| 8 |
template<class IntType = int>
|
| 9 |
class binomial_distribution {
|
| 10 |
public:
|
| 11 |
// types
|
| 12 |
using result_type = IntType;
|
| 13 |
using param_type = unspecified;
|
| 14 |
|
| 15 |
// constructors and reset functions
|
| 16 |
+
binomial_distribution() : binomial_distribution(1) {}
|
| 17 |
+
explicit binomial_distribution(IntType t, double p = 0.5);
|
| 18 |
explicit binomial_distribution(const param_type& parm);
|
| 19 |
void reset();
|
| 20 |
|
| 21 |
// generating functions
|
| 22 |
template<class URBG>
|
|
|
|
| 33 |
result_type max() const;
|
| 34 |
};
|
| 35 |
```
|
| 36 |
|
| 37 |
``` cpp
|
| 38 |
+
explicit binomial_distribution(IntType t, double p = 0.5);
|
| 39 |
```
|
| 40 |
|
| 41 |
+
*Preconditions:* 0 ≤ `p` ≤ 1 and 0 ≤ `t`.
|
| 42 |
|
| 43 |
+
*Remarks:* `t` and `p` correspond to the respective parameters of the
|
| 44 |
+
distribution.
|
| 45 |
|
| 46 |
``` cpp
|
| 47 |
IntType t() const;
|
| 48 |
```
|
| 49 |
|