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