tmp/tmp6iazotpm/{from.md → to.md}
RENAMED
|
@@ -13,16 +13,15 @@ the values wₖ, commonly known as the *weights* , shall be non-negative,
|
|
| 13 |
non-NaN, and non-infinity. Moreover, the following relation shall hold:
|
| 14 |
0 < S = w₀ + ⋯ + wₙ₋₁.
|
| 15 |
|
| 16 |
``` cpp
|
| 17 |
template<class IntType = int>
|
| 18 |
-
|
| 19 |
-
{
|
| 20 |
public:
|
| 21 |
// types
|
| 22 |
-
|
| 23 |
-
|
| 24 |
|
| 25 |
// constructor and reset functions
|
| 26 |
discrete_distribution();
|
| 27 |
template<class InputIterator>
|
| 28 |
discrete_distribution(InputIterator firstW, InputIterator lastW);
|
|
@@ -31,14 +30,14 @@ public:
|
|
| 31 |
discrete_distribution(size_t nw, double xmin, double xmax, UnaryOperation fw);
|
| 32 |
explicit discrete_distribution(const param_type& parm);
|
| 33 |
void reset();
|
| 34 |
|
| 35 |
// generating functions
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
|
| 41 |
// property functions
|
| 42 |
vector<double> probabilities() const;
|
| 43 |
param_type param() const;
|
| 44 |
void param(const param_type& parm);
|
|
@@ -50,19 +49,22 @@ public:
|
|
| 50 |
``` cpp
|
| 51 |
discrete_distribution();
|
| 52 |
```
|
| 53 |
|
| 54 |
*Effects:* Constructs a `discrete_distribution` object with n = 1 and
|
| 55 |
-
p₀ = 1.
|
|
|
|
|
|
|
|
|
|
| 56 |
|
| 57 |
``` cpp
|
| 58 |
template<class InputIterator>
|
| 59 |
discrete_distribution(InputIterator firstW, InputIterator lastW);
|
| 60 |
```
|
| 61 |
|
| 62 |
*Requires:* `InputIterator` shall satisfy the requirements of an input
|
| 63 |
-
iterator
|
| 64 |
`iterator_traits<InputIterator>::value_type` shall denote a type that is
|
| 65 |
convertible to `double`. If `firstW == lastW`, let n = 1 and w₀ = 1.
|
| 66 |
Otherwise, [`firstW`, `lastW`) shall form a sequence w of length n > 0.
|
| 67 |
|
| 68 |
*Effects:* Constructs a `discrete_distribution` object with
|
|
|
|
| 13 |
non-NaN, and non-infinity. Moreover, the following relation shall hold:
|
| 14 |
0 < S = w₀ + ⋯ + wₙ₋₁.
|
| 15 |
|
| 16 |
``` cpp
|
| 17 |
template<class IntType = int>
|
| 18 |
+
class discrete_distribution {
|
|
|
|
| 19 |
public:
|
| 20 |
// types
|
| 21 |
+
using result_type = IntType;
|
| 22 |
+
using param_type = unspecified;
|
| 23 |
|
| 24 |
// constructor and reset functions
|
| 25 |
discrete_distribution();
|
| 26 |
template<class InputIterator>
|
| 27 |
discrete_distribution(InputIterator firstW, InputIterator lastW);
|
|
|
|
| 30 |
discrete_distribution(size_t nw, double xmin, double xmax, UnaryOperation fw);
|
| 31 |
explicit discrete_distribution(const param_type& parm);
|
| 32 |
void reset();
|
| 33 |
|
| 34 |
// generating functions
|
| 35 |
+
template<class URBG>
|
| 36 |
+
result_type operator()(URBG& g);
|
| 37 |
+
template<class URBG>
|
| 38 |
+
result_type operator()(URBG& g, const param_type& parm);
|
| 39 |
|
| 40 |
// property functions
|
| 41 |
vector<double> probabilities() const;
|
| 42 |
param_type param() const;
|
| 43 |
void param(const param_type& parm);
|
|
|
|
| 49 |
``` cpp
|
| 50 |
discrete_distribution();
|
| 51 |
```
|
| 52 |
|
| 53 |
*Effects:* Constructs a `discrete_distribution` object with n = 1 and
|
| 54 |
+
p₀ = 1.
|
| 55 |
+
|
| 56 |
+
[*Note 1*: Such an object will always deliver the value
|
| 57 |
+
0. — *end note*]
|
| 58 |
|
| 59 |
``` cpp
|
| 60 |
template<class InputIterator>
|
| 61 |
discrete_distribution(InputIterator firstW, InputIterator lastW);
|
| 62 |
```
|
| 63 |
|
| 64 |
*Requires:* `InputIterator` shall satisfy the requirements of an input
|
| 65 |
+
iterator ([[input.iterators]]). Moreover,
|
| 66 |
`iterator_traits<InputIterator>::value_type` shall denote a type that is
|
| 67 |
convertible to `double`. If `firstW == lastW`, let n = 1 and w₀ = 1.
|
| 68 |
Otherwise, [`firstW`, `lastW`) shall form a sequence w of length n > 0.
|
| 69 |
|
| 70 |
*Effects:* Constructs a `discrete_distribution` object with
|