From Jason Turner

[rand.dist.uni]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpj5u41evn/{from.md → to.md} +15 -16
tmp/tmpj5u41evn/{from.md → to.md} RENAMED
@@ -2,24 +2,23 @@
2
 
3
  ##### Class template `uniform_int_distribution` <a id="rand.dist.uni.int">[[rand.dist.uni.int]]</a>
4
 
5
  A `uniform_int_distribution` random number distribution produces random
6
  integers i, a ≤ i ≤ b, distributed according to the constant discrete
7
- probability function $$%
8
- P(i\,|\,a,b) = 1 / (b - a + 1)
9
- \; \mbox{.}$$
10
 
11
  ``` cpp
12
  template<class IntType = int>
13
  class uniform_int_distribution {
14
  public:
15
  // types
16
  using result_type = IntType;
17
  using param_type = unspecified;
18
 
19
  // constructors and reset functions
20
- explicit uniform_int_distribution(IntType a = 0, IntType b = numeric_limits<IntType>::max());
 
21
  explicit uniform_int_distribution(const param_type& parm);
22
  void reset();
23
 
24
  // generating functions
25
  template<class URBG>
@@ -36,17 +35,17 @@ template<class IntType = int>
36
  result_type max() const;
37
  };
38
  ```
39
 
40
  ``` cpp
41
- explicit uniform_int_distribution(IntType a = 0, IntType b = numeric_limits<IntType>::max());
42
  ```
43
 
44
- *Requires:* `a` ≤ `b`.
45
 
46
- *Effects:* Constructs a `uniform_int_distribution` object; `a` and `b`
47
- correspond to the respective parameters of the distribution.
48
 
49
  ``` cpp
50
  result_type a() const;
51
  ```
52
 
@@ -62,13 +61,11 @@ constructed.
62
 
63
  ##### Class template `uniform_real_distribution` <a id="rand.dist.uni.real">[[rand.dist.uni.real]]</a>
64
 
65
  A `uniform_real_distribution` random number distribution produces random
66
  numbers x, a ≤ x < b, distributed according to the constant probability
67
- density function $$%
68
- p(x\,|\,a,b) = 1 / (b - a)
69
- \; \mbox{.}$$
70
 
71
  [*Note 1*: This implies that p(x | a,b) is undefined when
72
  `a == b`. — *end note*]
73
 
74
  ``` cpp
@@ -78,11 +75,12 @@ template<class RealType = double>
78
  // types
79
  using result_type = RealType;
80
  using param_type = unspecified;
81
 
82
  // constructors and reset functions
83
- explicit uniform_real_distribution(RealType a = 0.0, RealType b = 1.0);
 
84
  explicit uniform_real_distribution(const param_type& parm);
85
  void reset();
86
 
87
  // generating functions
88
  template<class URBG>
@@ -99,17 +97,18 @@ template<class RealType = double>
99
  result_type max() const;
100
  };
101
  ```
102
 
103
  ``` cpp
104
- explicit uniform_real_distribution(RealType a = 0.0, RealType b = 1.0);
105
  ```
106
 
107
- *Requires:* `a` ≤ `b` and `b` - `a` ≤ `numeric_limits<RealType>::max()`.
 
108
 
109
- *Effects:* Constructs a `uniform_real_distribution` object; `a` and `b`
110
- correspond to the respective parameters of the distribution.
111
 
112
  ``` cpp
113
  result_type a() const;
114
  ```
115
 
 
2
 
3
  ##### Class template `uniform_int_distribution` <a id="rand.dist.uni.int">[[rand.dist.uni.int]]</a>
4
 
5
  A `uniform_int_distribution` random number distribution produces random
6
  integers i, a ≤ i ≤ b, distributed according to the constant discrete
7
+ probability function $$P(i\,|\,a,b) = 1 / (b - a + 1) \text{ .}$$
 
 
8
 
9
  ``` cpp
10
  template<class IntType = int>
11
  class uniform_int_distribution {
12
  public:
13
  // types
14
  using result_type = IntType;
15
  using param_type = unspecified;
16
 
17
  // constructors and reset functions
18
+ uniform_int_distribution() : uniform_int_distribution(0) {}
19
+ explicit uniform_int_distribution(IntType a, IntType b = numeric_limits<IntType>::max());
20
  explicit uniform_int_distribution(const param_type& parm);
21
  void reset();
22
 
23
  // generating functions
24
  template<class URBG>
 
35
  result_type max() const;
36
  };
37
  ```
38
 
39
  ``` cpp
40
+ explicit uniform_int_distribution(IntType a, IntType b = numeric_limits<IntType>::max());
41
  ```
42
 
43
+ *Preconditions:* `a` ≤ `b`.
44
 
45
+ *Remarks:* `a` and `b` correspond to the respective parameters of the
46
+ distribution.
47
 
48
  ``` cpp
49
  result_type a() const;
50
  ```
51
 
 
61
 
62
  ##### Class template `uniform_real_distribution` <a id="rand.dist.uni.real">[[rand.dist.uni.real]]</a>
63
 
64
  A `uniform_real_distribution` random number distribution produces random
65
  numbers x, a ≤ x < b, distributed according to the constant probability
66
+ density function $$p(x\,|\,a,b) = 1 / (b - a) \text{ .}$$
 
 
67
 
68
  [*Note 1*: This implies that p(x | a,b) is undefined when
69
  `a == b`. — *end note*]
70
 
71
  ``` cpp
 
75
  // types
76
  using result_type = RealType;
77
  using param_type = unspecified;
78
 
79
  // constructors and reset functions
80
+ uniform_real_distribution() : uniform_real_distribution(0.0) {}
81
+ explicit uniform_real_distribution(RealType a, RealType b = 1.0);
82
  explicit uniform_real_distribution(const param_type& parm);
83
  void reset();
84
 
85
  // generating functions
86
  template<class URBG>
 
97
  result_type max() const;
98
  };
99
  ```
100
 
101
  ``` cpp
102
+ explicit uniform_real_distribution(RealType a, RealType b = 1.0);
103
  ```
104
 
105
+ *Preconditions:* `a` ≤ `b` and
106
+ `b` - `a` ≤ `numeric_limits<RealType>::max()`.
107
 
108
+ *Remarks:* `a` and `b` correspond to the respective parameters of the
109
+ distribution.
110
 
111
  ``` cpp
112
  result_type a() const;
113
  ```
114