tmp/tmpwp3nto2u/{from.md → to.md}
RENAMED
|
@@ -1,19 +1,24 @@
|
|
| 1 |
### Random number engine adaptor class templates <a id="rand.adapt">[[rand.adapt]]</a>
|
| 2 |
|
| 3 |
#### In general <a id="rand.adapt.general">[[rand.adapt.general]]</a>
|
| 4 |
|
| 5 |
Each type instantiated from a class template specified in this section
|
| 6 |
-
[[rand.
|
| 7 |
adaptor ([[rand.req.adapt]]) type.
|
| 8 |
|
| 9 |
Except where specified otherwise, the complexity of each function
|
| 10 |
specified in this section [[rand.adapt]] is constant.
|
| 11 |
|
| 12 |
Except where specified otherwise, no function described in this section
|
| 13 |
[[rand.adapt]] throws an exception.
|
| 14 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
Descriptions are provided in this section [[rand.adapt]] only for
|
| 16 |
adaptor operations that are not described in section [[rand.req.adapt]]
|
| 17 |
or for operations where there is additional semantic information. In
|
| 18 |
particular, declarations for copy constructors, for copy assignment
|
| 19 |
operators, for streaming operators, and for equality and inequality
|
|
@@ -41,15 +46,14 @@ state eⱼ to eⱼ₊₁.
|
|
| 41 |
The generation algorithm yields the value returned by the last
|
| 42 |
invocation of `e()` while advancing `e`’s state as described above.
|
| 43 |
|
| 44 |
``` cpp
|
| 45 |
template<class Engine, size_t p, size_t r>
|
| 46 |
-
|
| 47 |
-
{
|
| 48 |
public:
|
| 49 |
// types
|
| 50 |
-
|
| 51 |
|
| 52 |
// engine characteristics
|
| 53 |
static constexpr size_t block_size = p;
|
| 54 |
static constexpr size_t used_block = r;
|
| 55 |
static constexpr result_type min() { return Engine::min(); }
|
|
@@ -96,11 +100,12 @@ state eᵢ of its base engine `e`; the size of the state is the size of
|
|
| 96 |
e’s state.
|
| 97 |
|
| 98 |
The transition and generation algorithms are described in terms of the
|
| 99 |
following integral constants:
|
| 100 |
|
| 101 |
-
The relation w = n₀ w₀ + (n - n₀)(w₀ + 1) always
|
|
|
|
| 102 |
|
| 103 |
The transition algorithm is carried out by invoking `e()` as often as
|
| 104 |
needed to obtain n₀ values less than y₀ + `e.min()` and n - n₀ values
|
| 105 |
less than y₁ + `e.min()` .
|
| 106 |
|
|
@@ -120,15 +125,14 @@ for (k = n₀; k \neq n; k += 1) {
|
|
| 120 |
}
|
| 121 |
```
|
| 122 |
|
| 123 |
``` cpp
|
| 124 |
template<class Engine, size_t w, class UIntType>
|
| 125 |
-
class independent_bits_engine
|
| 126 |
-
{
|
| 127 |
public:
|
| 128 |
// types
|
| 129 |
-
|
| 130 |
|
| 131 |
// engine characteristics
|
| 132 |
static constexpr result_type min() { return 0; }
|
| 133 |
static constexpr result_type max() { return 2^w - 1; }
|
| 134 |
|
|
@@ -176,15 +180,14 @@ transition is performed as follows:
|
|
| 176 |
The generation algorithm yields the last value of `Y` produced while
|
| 177 |
advancing `e`’s state as described above.
|
| 178 |
|
| 179 |
``` cpp
|
| 180 |
template<class Engine, size_t k>
|
| 181 |
-
|
| 182 |
-
{
|
| 183 |
public:
|
| 184 |
// types
|
| 185 |
-
|
| 186 |
|
| 187 |
// engine characteristics
|
| 188 |
static constexpr size_t table_size = k;
|
| 189 |
static constexpr result_type min() { return Engine::min(); }
|
| 190 |
static constexpr result_type max() { return Engine::max(); }
|
|
@@ -206,12 +209,12 @@ public:
|
|
| 206 |
// property functions
|
| 207 |
const Engine& base() const noexcept { return e; };
|
| 208 |
|
| 209 |
private:
|
| 210 |
Engine e; // exposition only
|
| 211 |
-
result_type Y; // exposition only
|
| 212 |
result_type V[k]; // exposition only
|
|
|
|
| 213 |
};
|
| 214 |
```
|
| 215 |
|
| 216 |
The following relation shall hold: `0 < k`.
|
| 217 |
|
|
|
|
| 1 |
### Random number engine adaptor class templates <a id="rand.adapt">[[rand.adapt]]</a>
|
| 2 |
|
| 3 |
#### In general <a id="rand.adapt.general">[[rand.adapt.general]]</a>
|
| 4 |
|
| 5 |
Each type instantiated from a class template specified in this section
|
| 6 |
+
[[rand.adapt]] satisfies the requirements of a random number engine
|
| 7 |
adaptor ([[rand.req.adapt]]) type.
|
| 8 |
|
| 9 |
Except where specified otherwise, the complexity of each function
|
| 10 |
specified in this section [[rand.adapt]] is constant.
|
| 11 |
|
| 12 |
Except where specified otherwise, no function described in this section
|
| 13 |
[[rand.adapt]] throws an exception.
|
| 14 |
|
| 15 |
+
Every function described in this section [[rand.adapt]] that has a
|
| 16 |
+
function parameter `q` of type `Sseq&` for a template type parameter
|
| 17 |
+
named `Sseq` that is different from type `seed_seq` throws what and when
|
| 18 |
+
the invocation of `q.generate` throws.
|
| 19 |
+
|
| 20 |
Descriptions are provided in this section [[rand.adapt]] only for
|
| 21 |
adaptor operations that are not described in section [[rand.req.adapt]]
|
| 22 |
or for operations where there is additional semantic information. In
|
| 23 |
particular, declarations for copy constructors, for copy assignment
|
| 24 |
operators, for streaming operators, and for equality and inequality
|
|
|
|
| 46 |
The generation algorithm yields the value returned by the last
|
| 47 |
invocation of `e()` while advancing `e`’s state as described above.
|
| 48 |
|
| 49 |
``` cpp
|
| 50 |
template<class Engine, size_t p, size_t r>
|
| 51 |
+
class discard_block_engine {
|
|
|
|
| 52 |
public:
|
| 53 |
// types
|
| 54 |
+
using result_type = typename Engine::result_type;
|
| 55 |
|
| 56 |
// engine characteristics
|
| 57 |
static constexpr size_t block_size = p;
|
| 58 |
static constexpr size_t used_block = r;
|
| 59 |
static constexpr result_type min() { return Engine::min(); }
|
|
|
|
| 100 |
e’s state.
|
| 101 |
|
| 102 |
The transition and generation algorithms are described in terms of the
|
| 103 |
following integral constants:
|
| 104 |
|
| 105 |
+
[*Note 1*: The relation w = n₀ w₀ + (n - n₀)(w₀ + 1) always
|
| 106 |
+
holds. — *end note*]
|
| 107 |
|
| 108 |
The transition algorithm is carried out by invoking `e()` as often as
|
| 109 |
needed to obtain n₀ values less than y₀ + `e.min()` and n - n₀ values
|
| 110 |
less than y₁ + `e.min()` .
|
| 111 |
|
|
|
|
| 125 |
}
|
| 126 |
```
|
| 127 |
|
| 128 |
``` cpp
|
| 129 |
template<class Engine, size_t w, class UIntType>
|
| 130 |
+
class independent_bits_engine {
|
|
|
|
| 131 |
public:
|
| 132 |
// types
|
| 133 |
+
using result_type = UIntType;
|
| 134 |
|
| 135 |
// engine characteristics
|
| 136 |
static constexpr result_type min() { return 0; }
|
| 137 |
static constexpr result_type max() { return 2^w - 1; }
|
| 138 |
|
|
|
|
| 180 |
The generation algorithm yields the last value of `Y` produced while
|
| 181 |
advancing `e`’s state as described above.
|
| 182 |
|
| 183 |
``` cpp
|
| 184 |
template<class Engine, size_t k>
|
| 185 |
+
class shuffle_order_engine {
|
|
|
|
| 186 |
public:
|
| 187 |
// types
|
| 188 |
+
using result_type = typename Engine::result_type;
|
| 189 |
|
| 190 |
// engine characteristics
|
| 191 |
static constexpr size_t table_size = k;
|
| 192 |
static constexpr result_type min() { return Engine::min(); }
|
| 193 |
static constexpr result_type max() { return Engine::max(); }
|
|
|
|
| 209 |
// property functions
|
| 210 |
const Engine& base() const noexcept { return e; };
|
| 211 |
|
| 212 |
private:
|
| 213 |
Engine e; // exposition only
|
|
|
|
| 214 |
result_type V[k]; // exposition only
|
| 215 |
+
result_type Y; // exposition only
|
| 216 |
};
|
| 217 |
```
|
| 218 |
|
| 219 |
The following relation shall hold: `0 < k`.
|
| 220 |
|