tmp/tmpbyuzopl_/{from.md → to.md}
RENAMED
|
@@ -6,75 +6,78 @@ Throughout this subclause [[rand]], the effect of instantiating a
|
|
| 6 |
template:
|
| 7 |
|
| 8 |
Throughout this subclause [[rand]], phrases of the form “`x` is an
|
| 9 |
iterator of a specific kind” shall be interpreted as equivalent to the
|
| 10 |
more formal requirement that “`x` is a value of a type satisfying the
|
| 11 |
-
requirements of the specified iterator type
|
| 12 |
|
| 13 |
Throughout this subclause [[rand]], any constructor that can be called
|
| 14 |
with a single argument and that satisfies a requirement specified in
|
| 15 |
this subclause shall be declared `explicit`.
|
| 16 |
|
| 17 |
#### Seed sequence requirements <a id="rand.req.seedseq">[[rand.req.seedseq]]</a>
|
| 18 |
|
| 19 |
A *seed sequence* is an object that consumes a sequence of
|
| 20 |
integer-valued data and produces a requested number of unsigned integer
|
| 21 |
-
values i, 0 ≤ i < 2³², based on the consumed data.
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
of random
|
|
|
|
|
|
|
| 25 |
|
| 26 |
A class `S` satisfies the requirements of a seed sequence if the
|
| 27 |
expressions shown in Table [[tab:SeedSequence]] are valid and have the
|
| 28 |
indicated semantics, and if `S` also satisfies all other requirements of
|
| 29 |
this section [[rand.req.seedseq]]. In that Table and throughout this
|
| 30 |
section:
|
| 31 |
|
| 32 |
-
#### Uniform random
|
| 33 |
|
| 34 |
-
A *uniform random
|
| 35 |
returning unsigned integer values such that each value in the range of
|
| 36 |
-
possible results has (ideally) equal probability of being returned.
|
| 37 |
-
degree to which `g`’s results approximate the ideal is often determined
|
| 38 |
-
statistically.
|
| 39 |
|
| 40 |
-
|
|
|
|
|
|
|
|
|
|
| 41 |
generator* if the expressions shown in Table
|
| 42 |
-
[[tab:
|
| 43 |
semantics, and if `G` also satisfies all other requirements of this
|
| 44 |
section [[rand.req.urng]]. In that Table and throughout this section:
|
| 45 |
|
| 46 |
The following relation shall hold: `G::min() < G::max()`.
|
| 47 |
|
| 48 |
#### Random number engine requirements <a id="rand.req.eng">[[rand.req.eng]]</a>
|
| 49 |
|
| 50 |
A *random number engine* (commonly shortened to *engine*) `e` of type
|
| 51 |
-
`E` is a uniform random
|
| 52 |
-
requirements (
|
| 53 |
-
|
| 54 |
|
| 55 |
At any given time, `e` has a state eᵢ for some integer i ≥ 0. Upon
|
| 56 |
construction, `e` has an initial state e₀. An engine’s state may be
|
| 57 |
established via a constructor, a `seed` function, assignment, or a
|
| 58 |
suitable `operator>>`.
|
| 59 |
|
| 60 |
`E`’s specification shall define:
|
| 61 |
|
| 62 |
-
A class `E` that satisfies the requirements of a uniform random
|
| 63 |
generator ([[rand.req.urng]]) also satisfies the requirements of a
|
| 64 |
*random number engine* if the expressions shown in Table
|
| 65 |
[[tab:RandomEngine]] are valid and have the indicated semantics, and if
|
| 66 |
`E` also satisfies all other requirements of this section
|
| 67 |
[[rand.req.eng]]. In that Table and throughout this section:
|
| 68 |
|
| 69 |
where `charT` and `traits` are constrained according to Clause
|
| 70 |
[[strings]] and Clause [[input.output]].
|
| 71 |
|
| 72 |
`E` shall meet the requirements of `CopyConstructible` (Table
|
| 73 |
-
[[copyconstructible]]) and `CopyAssignable` (Table
|
| 74 |
-
types. These operations shall each be of
|
| 75 |
-
𝑂(\mbox{size of state}).
|
| 76 |
|
| 77 |
#### Random number engine adaptor requirements <a id="rand.req.adapt">[[rand.req.adapt]]</a>
|
| 78 |
|
| 79 |
A *random number engine adaptor* (commonly shortened to *adaptor*) `a`
|
| 80 |
of type `A` is a random number engine that takes values produced by some
|
|
@@ -106,11 +109,11 @@ A::A(result_type s);
|
|
| 106 |
```
|
| 107 |
|
| 108 |
*Effects:* The base engine is initialized with `s`.
|
| 109 |
|
| 110 |
``` cpp
|
| 111 |
-
template<class Sseq>
|
| 112 |
```
|
| 113 |
|
| 114 |
*Effects:* The base engine is initialized with `q`.
|
| 115 |
|
| 116 |
``` cpp
|
|
@@ -158,12 +161,12 @@ In that Table and throughout this section,
|
|
| 158 |
|
| 159 |
where `charT` and `traits` are constrained according to Clauses
|
| 160 |
[[strings]] and [[input.output]].
|
| 161 |
|
| 162 |
`D` shall satisfy the requirements of `CopyConstructible` (Table
|
| 163 |
-
[[copyconstructible]]) and `CopyAssignable` (Table
|
| 164 |
-
types.
|
| 165 |
|
| 166 |
The sequence of numbers produced by repeated invocations of `d(g)` shall
|
| 167 |
be independent of any invocation of `os << d` or of any `const` member
|
| 168 |
function of `D` between any of the invocations `d(g)`.
|
| 169 |
|
|
@@ -177,12 +180,13 @@ It is unspecified whether `D::param_type` is declared as a (nested)
|
|
| 177 |
`class` or via a `typedef`. In this subclause [[rand]], declarations of
|
| 178 |
`D::param_type` are in the form of `typedef`s for convenience of
|
| 179 |
exposition only.
|
| 180 |
|
| 181 |
`P` shall satisfy the requirements of `CopyConstructible` (Table
|
| 182 |
-
[[copyconstructible]]), `CopyAssignable` (Table
|
| 183 |
-
and `EqualityComparable` (Table
|
|
|
|
| 184 |
|
| 185 |
For each of the constructors of `D` taking arguments corresponding to
|
| 186 |
parameters of the distribution, `P` shall have a corresponding
|
| 187 |
constructor subject to the same requirements and taking arguments
|
| 188 |
identical in number, type, and default values. Moreover, for each of the
|
|
@@ -191,8 +195,8 @@ of the distribution, `P` shall have a corresponding member function with
|
|
| 191 |
the identical name, type, and semantics.
|
| 192 |
|
| 193 |
`P` shall have a declaration of the form
|
| 194 |
|
| 195 |
``` cpp
|
| 196 |
-
|
| 197 |
```
|
| 198 |
|
|
|
|
| 6 |
template:
|
| 7 |
|
| 8 |
Throughout this subclause [[rand]], phrases of the form “`x` is an
|
| 9 |
iterator of a specific kind” shall be interpreted as equivalent to the
|
| 10 |
more formal requirement that “`x` is a value of a type satisfying the
|
| 11 |
+
requirements of the specified iterator type”.
|
| 12 |
|
| 13 |
Throughout this subclause [[rand]], any constructor that can be called
|
| 14 |
with a single argument and that satisfies a requirement specified in
|
| 15 |
this subclause shall be declared `explicit`.
|
| 16 |
|
| 17 |
#### Seed sequence requirements <a id="rand.req.seedseq">[[rand.req.seedseq]]</a>
|
| 18 |
|
| 19 |
A *seed sequence* is an object that consumes a sequence of
|
| 20 |
integer-valued data and produces a requested number of unsigned integer
|
| 21 |
+
values i, 0 ≤ i < 2³², based on the consumed data.
|
| 22 |
+
|
| 23 |
+
[*Note 1*: Such an object provides a mechanism to avoid replication of
|
| 24 |
+
streams of random variates. This can be useful, for example, in
|
| 25 |
+
applications requiring large numbers of random number
|
| 26 |
+
engines. — *end note*]
|
| 27 |
|
| 28 |
A class `S` satisfies the requirements of a seed sequence if the
|
| 29 |
expressions shown in Table [[tab:SeedSequence]] are valid and have the
|
| 30 |
indicated semantics, and if `S` also satisfies all other requirements of
|
| 31 |
this section [[rand.req.seedseq]]. In that Table and throughout this
|
| 32 |
section:
|
| 33 |
|
| 34 |
+
#### Uniform random bit generator requirements <a id="rand.req.urng">[[rand.req.urng]]</a>
|
| 35 |
|
| 36 |
+
A *uniform random bit generator* `g` of type `G` is a function object
|
| 37 |
returning unsigned integer values such that each value in the range of
|
| 38 |
+
possible results has (ideally) equal probability of being returned.
|
|
|
|
|
|
|
| 39 |
|
| 40 |
+
[*Note 1*: The degree to which `g`’s results approximate the ideal is
|
| 41 |
+
often determined statistically. — *end note*]
|
| 42 |
+
|
| 43 |
+
A class `G` satisfies the requirements of a *uniform random bit
|
| 44 |
generator* if the expressions shown in Table
|
| 45 |
+
[[tab:UniformRandomBitGenerator]] are valid and have the indicated
|
| 46 |
semantics, and if `G` also satisfies all other requirements of this
|
| 47 |
section [[rand.req.urng]]. In that Table and throughout this section:
|
| 48 |
|
| 49 |
The following relation shall hold: `G::min() < G::max()`.
|
| 50 |
|
| 51 |
#### Random number engine requirements <a id="rand.req.eng">[[rand.req.eng]]</a>
|
| 52 |
|
| 53 |
A *random number engine* (commonly shortened to *engine*) `e` of type
|
| 54 |
+
`E` is a uniform random bit generator that additionally meets the
|
| 55 |
+
requirements (e.g., for seeding and for input/output) specified in this
|
| 56 |
+
section.
|
| 57 |
|
| 58 |
At any given time, `e` has a state eᵢ for some integer i ≥ 0. Upon
|
| 59 |
construction, `e` has an initial state e₀. An engine’s state may be
|
| 60 |
established via a constructor, a `seed` function, assignment, or a
|
| 61 |
suitable `operator>>`.
|
| 62 |
|
| 63 |
`E`’s specification shall define:
|
| 64 |
|
| 65 |
+
A class `E` that satisfies the requirements of a uniform random bit
|
| 66 |
generator ([[rand.req.urng]]) also satisfies the requirements of a
|
| 67 |
*random number engine* if the expressions shown in Table
|
| 68 |
[[tab:RandomEngine]] are valid and have the indicated semantics, and if
|
| 69 |
`E` also satisfies all other requirements of this section
|
| 70 |
[[rand.req.eng]]. In that Table and throughout this section:
|
| 71 |
|
| 72 |
where `charT` and `traits` are constrained according to Clause
|
| 73 |
[[strings]] and Clause [[input.output]].
|
| 74 |
|
| 75 |
`E` shall meet the requirements of `CopyConstructible` (Table
|
| 76 |
+
[[tab:copyconstructible]]) and `CopyAssignable` (Table
|
| 77 |
+
[[tab:copyassignable]]) types. These operations shall each be of
|
| 78 |
+
complexity no worse than 𝑂(\mbox{size of state}).
|
| 79 |
|
| 80 |
#### Random number engine adaptor requirements <a id="rand.req.adapt">[[rand.req.adapt]]</a>
|
| 81 |
|
| 82 |
A *random number engine adaptor* (commonly shortened to *adaptor*) `a`
|
| 83 |
of type `A` is a random number engine that takes values produced by some
|
|
|
|
| 109 |
```
|
| 110 |
|
| 111 |
*Effects:* The base engine is initialized with `s`.
|
| 112 |
|
| 113 |
``` cpp
|
| 114 |
+
template<class Sseq> A::A(Sseq& q);
|
| 115 |
```
|
| 116 |
|
| 117 |
*Effects:* The base engine is initialized with `q`.
|
| 118 |
|
| 119 |
``` cpp
|
|
|
|
| 161 |
|
| 162 |
where `charT` and `traits` are constrained according to Clauses
|
| 163 |
[[strings]] and [[input.output]].
|
| 164 |
|
| 165 |
`D` shall satisfy the requirements of `CopyConstructible` (Table
|
| 166 |
+
[[tab:copyconstructible]]) and `CopyAssignable` (Table
|
| 167 |
+
[[tab:copyassignable]]) types.
|
| 168 |
|
| 169 |
The sequence of numbers produced by repeated invocations of `d(g)` shall
|
| 170 |
be independent of any invocation of `os << d` or of any `const` member
|
| 171 |
function of `D` between any of the invocations `d(g)`.
|
| 172 |
|
|
|
|
| 180 |
`class` or via a `typedef`. In this subclause [[rand]], declarations of
|
| 181 |
`D::param_type` are in the form of `typedef`s for convenience of
|
| 182 |
exposition only.
|
| 183 |
|
| 184 |
`P` shall satisfy the requirements of `CopyConstructible` (Table
|
| 185 |
+
[[tab:copyconstructible]]), `CopyAssignable` (Table
|
| 186 |
+
[[tab:copyassignable]]), and `EqualityComparable` (Table
|
| 187 |
+
[[tab:equalitycomparable]]) types.
|
| 188 |
|
| 189 |
For each of the constructors of `D` taking arguments corresponding to
|
| 190 |
parameters of the distribution, `P` shall have a corresponding
|
| 191 |
constructor subject to the same requirements and taking arguments
|
| 192 |
identical in number, type, and default values. Moreover, for each of the
|
|
|
|
| 195 |
the identical name, type, and semantics.
|
| 196 |
|
| 197 |
`P` shall have a declaration of the form
|
| 198 |
|
| 199 |
``` cpp
|
| 200 |
+
using distribution_type = D;
|
| 201 |
```
|
| 202 |
|