tmp/tmp8dk6l0mh/{from.md → to.md}
RENAMED
|
@@ -5,29 +5,31 @@ random integers i ≥ 0 distributed according to the discrete probability
|
|
| 5 |
function $$%
|
| 6 |
P(i\,|\,k,p)
|
| 7 |
= \binom{k+i-1}{i} \cdot p^k \cdot (1-p)^i
|
| 8 |
\; \mbox{.}$$
|
| 9 |
|
|
|
|
|
|
|
|
|
|
| 10 |
``` cpp
|
| 11 |
template<class IntType = int>
|
| 12 |
-
|
| 13 |
-
{
|
| 14 |
public:
|
| 15 |
// types
|
| 16 |
-
|
| 17 |
-
|
| 18 |
|
| 19 |
// constructor and reset functions
|
| 20 |
explicit negative_binomial_distribution(IntType k = 1, double p = 0.5);
|
| 21 |
explicit negative_binomial_distribution(const param_type& parm);
|
| 22 |
void reset();
|
| 23 |
|
| 24 |
// generating functions
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
|
| 30 |
// property functions
|
| 31 |
IntType k() const;
|
| 32 |
double p() const;
|
| 33 |
param_type param() const;
|
|
|
|
| 5 |
function $$%
|
| 6 |
P(i\,|\,k,p)
|
| 7 |
= \binom{k+i-1}{i} \cdot p^k \cdot (1-p)^i
|
| 8 |
\; \mbox{.}$$
|
| 9 |
|
| 10 |
+
[*Note 1*: This implies that P(i | k,p) is undefined when
|
| 11 |
+
`p == 1`. — *end note*]
|
| 12 |
+
|
| 13 |
``` cpp
|
| 14 |
template<class IntType = int>
|
| 15 |
+
class negative_binomial_distribution {
|
|
|
|
| 16 |
public:
|
| 17 |
// types
|
| 18 |
+
using result_type = IntType;
|
| 19 |
+
using param_type = unspecified;
|
| 20 |
|
| 21 |
// constructor and reset functions
|
| 22 |
explicit negative_binomial_distribution(IntType k = 1, double p = 0.5);
|
| 23 |
explicit negative_binomial_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 |
IntType k() const;
|
| 34 |
double p() const;
|
| 35 |
param_type param() const;
|