From Jason Turner

[rand.dist.bern.negbin]

Diff to HTML by rtfpessoa

tmp/tmpvr7t_b5e/{from.md → to.md} RENAMED
@@ -1,13 +1,11 @@
1
  ##### Class template `negative_binomial_distribution` <a id="rand.dist.bern.negbin">[[rand.dist.bern.negbin]]</a>
2
 
3
  A `negative_binomial_distribution` random number distribution produces
4
  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
  [*Note 1*: This implies that P(i | k,p) is undefined when
11
  `p == 1`. — *end note*]
12
 
13
  ``` cpp
@@ -17,11 +15,12 @@ template<class IntType = int>
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>
@@ -38,17 +37,17 @@ template<class IntType = int>
38
  result_type max() const;
39
  };
40
  ```
41
 
42
  ``` cpp
43
- explicit negative_binomial_distribution(IntType k = 1, double p = 0.5);
44
  ```
45
 
46
- *Requires:* 0 < `p` ≤ 1 and 0 < `k`.
47
 
48
- *Effects:* Constructs a `negative_binomial_distribution` object; `k` and
49
- `p` correspond to the respective parameters of the distribution.
50
 
51
  ``` cpp
52
  IntType k() const;
53
  ```
54
 
 
1
  ##### Class template `negative_binomial_distribution` <a id="rand.dist.bern.negbin">[[rand.dist.bern.negbin]]</a>
2
 
3
  A `negative_binomial_distribution` random number distribution produces
4
  random integers i ≥ 0 distributed according to the discrete probability
5
+ function
6
+ $$P(i\,|\,k,p) = \binom{k+i-1}{i} \cdot p^k \cdot (1-p)^i \text{ .}$$
 
 
7
 
8
  [*Note 1*: This implies that P(i | k,p) is undefined when
9
  `p == 1`. — *end note*]
10
 
11
  ``` cpp
 
15
  // types
16
  using result_type = IntType;
17
  using param_type = unspecified;
18
 
19
  // constructor and reset functions
20
+ negative_binomial_distribution() : negative_binomial_distribution(1) {}
21
+ explicit negative_binomial_distribution(IntType k, double p = 0.5);
22
  explicit negative_binomial_distribution(const param_type& parm);
23
  void reset();
24
 
25
  // generating functions
26
  template<class URBG>
 
37
  result_type max() const;
38
  };
39
  ```
40
 
41
  ``` cpp
42
+ explicit negative_binomial_distribution(IntType k, double p = 0.5);
43
  ```
44
 
45
+ *Preconditions:* 0 < `p` ≤ 1 and 0 < `k`.
46
 
47
+ *Remarks:* `k` and `p` correspond to the respective parameters of the
48
+ distribution.
49
 
50
  ``` cpp
51
  IntType k() const;
52
  ```
53