tmp/tmpna4nz7jk/{from.md → to.md}
RENAMED
|
@@ -3,10 +3,11 @@
|
|
| 3 |
A `uniform_int_distribution` random number distribution produces random
|
| 4 |
integers i, a ≤ i ≤ b, distributed according to the constant discrete
|
| 5 |
probability function $$P(i\,|\,a,b) = 1 / (b - a + 1) \text{ .}$$
|
| 6 |
|
| 7 |
``` cpp
|
|
|
|
| 8 |
template<class IntType = int>
|
| 9 |
class uniform_int_distribution {
|
| 10 |
public:
|
| 11 |
// types
|
| 12 |
using result_type = IntType;
|
|
@@ -16,10 +17,13 @@ template<class IntType = int>
|
|
| 16 |
uniform_int_distribution() : uniform_int_distribution(0) {}
|
| 17 |
explicit uniform_int_distribution(IntType a, IntType b = numeric_limits<IntType>::max());
|
| 18 |
explicit uniform_int_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 |
result_type b() 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 uniform_int_distribution(IntType a, IntType b = numeric_limits<IntType>::max());
|
| 39 |
```
|
|
|
|
| 3 |
A `uniform_int_distribution` random number distribution produces random
|
| 4 |
integers i, a ≤ i ≤ b, distributed according to the constant discrete
|
| 5 |
probability function $$P(i\,|\,a,b) = 1 / (b - a + 1) \text{ .}$$
|
| 6 |
|
| 7 |
``` cpp
|
| 8 |
+
namespace std {
|
| 9 |
template<class IntType = int>
|
| 10 |
class uniform_int_distribution {
|
| 11 |
public:
|
| 12 |
// types
|
| 13 |
using result_type = IntType;
|
|
|
|
| 17 |
uniform_int_distribution() : uniform_int_distribution(0) {}
|
| 18 |
explicit uniform_int_distribution(IntType a, IntType b = numeric_limits<IntType>::max());
|
| 19 |
explicit uniform_int_distribution(const param_type& parm);
|
| 20 |
void reset();
|
| 21 |
|
| 22 |
+
// equality operators
|
| 23 |
+
friend bool operator==(const uniform_int_distribution& x, const uniform_int_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 |
result_type b() 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 uniform_int_distribution& x);
|
| 43 |
+
template<class charT, class traits>
|
| 44 |
+
friend basic_istream<charT, traits>&
|
| 45 |
+
operator>>(basic_istream<charT, traits>& is, uniform_int_distribution& x);
|
| 46 |
};
|
| 47 |
+
}
|
| 48 |
```
|
| 49 |
|
| 50 |
``` cpp
|
| 51 |
explicit uniform_int_distribution(IntType a, IntType b = numeric_limits<IntType>::max());
|
| 52 |
```
|