tmp/tmplsf3tcqb/{from.md → to.md}
RENAMED
|
@@ -3,10 +3,11 @@
|
|
| 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;
|
|
@@ -16,10 +17,13 @@ template<class IntType = int>
|
|
| 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>
|
| 23 |
result_type operator()(URBG& g);
|
| 24 |
template<class URBG>
|
| 25 |
result_type operator()(URBG& g, const param_type& parm);
|
|
@@ -29,11 +33,20 @@ template<class IntType = int>
|
|
| 29 |
double p() const;
|
| 30 |
param_type param() const;
|
| 31 |
void param(const param_type& parm);
|
| 32 |
result_type min() const;
|
| 33 |
result_type max() const;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 34 |
};
|
|
|
|
| 35 |
```
|
| 36 |
|
| 37 |
``` cpp
|
| 38 |
explicit binomial_distribution(IntType t, double p = 0.5);
|
| 39 |
```
|
|
|
|
| 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 |
+
namespace std {
|
| 9 |
template<class IntType = int>
|
| 10 |
class binomial_distribution {
|
| 11 |
public:
|
| 12 |
// types
|
| 13 |
using result_type = IntType;
|
|
|
|
| 17 |
binomial_distribution() : binomial_distribution(1) {}
|
| 18 |
explicit binomial_distribution(IntType t, double p = 0.5);
|
| 19 |
explicit binomial_distribution(const param_type& parm);
|
| 20 |
void reset();
|
| 21 |
|
| 22 |
+
// equality operators
|
| 23 |
+
friend bool operator==(const binomial_distribution& x, const binomial_distribution& y);
|
| 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);
|
|
|
|
| 33 |
double p() const;
|
| 34 |
param_type param() const;
|
| 35 |
void param(const param_type& parm);
|
| 36 |
result_type min() const;
|
| 37 |
result_type max() const;
|
| 38 |
+
|
| 39 |
+
// inserters and extractors
|
| 40 |
+
template<class charT, class traits>
|
| 41 |
+
friend basic_ostream<charT, traits>&
|
| 42 |
+
operator<<(basic_ostream<charT, traits>& os, const binomial_distribution& x);
|
| 43 |
+
template<class charT, class traits>
|
| 44 |
+
friend basic_istream<charT, traits>&
|
| 45 |
+
operator>>(basic_istream<charT, traits>& is, binomial_distribution& x);
|
| 46 |
};
|
| 47 |
+
}
|
| 48 |
```
|
| 49 |
|
| 50 |
``` cpp
|
| 51 |
explicit binomial_distribution(IntType t, double p = 0.5);
|
| 52 |
```
|