tmp/tmpfrsgh9sw/{from.md → to.md}
RENAMED
|
@@ -33,35 +33,35 @@ private:
|
|
| 33 |
|
| 34 |
``` cpp
|
| 35 |
seed_seq();
|
| 36 |
```
|
| 37 |
|
| 38 |
-
*
|
| 39 |
-
its member `v`.
|
| 40 |
|
| 41 |
*Throws:* Nothing.
|
| 42 |
|
| 43 |
``` cpp
|
| 44 |
template<class T>
|
| 45 |
seed_seq(initializer_list<T> il);
|
| 46 |
```
|
| 47 |
|
| 48 |
-
*
|
| 49 |
|
| 50 |
*Effects:* Same as `seed_seq(il.begin(), il.end())`.
|
| 51 |
|
| 52 |
``` cpp
|
| 53 |
template<class InputIterator>
|
| 54 |
seed_seq(InputIterator begin, InputIterator end);
|
| 55 |
```
|
| 56 |
|
| 57 |
-
*
|
| 58 |
-
iterator (Table [[tab:iterator.input.requirements]]) type. Moreover,
|
| 59 |
-
`iterator_traits<InputIterator>::value_type` shall denote an integer
|
| 60 |
type.
|
| 61 |
|
| 62 |
-
*
|
|
|
|
|
|
|
|
|
|
| 63 |
|
| 64 |
``` cpp
|
| 65 |
for (InputIterator s = begin; s != end; ++s)
|
| 66 |
v.push_back((*s) mod 2³²);
|
| 67 |
```
|
|
@@ -69,21 +69,63 @@ for( InputIterator s = begin; s != end; ++s)
|
|
| 69 |
``` cpp
|
| 70 |
template<class RandomAccessIterator>
|
| 71 |
void generate(RandomAccessIterator begin, RandomAccessIterator end);
|
| 72 |
```
|
| 73 |
|
| 74 |
-
*
|
| 75 |
-
mutable random access iterator ([[random.access.iterators]]). Moreover,
|
| 76 |
-
`iterator_traits<RandomAccessIterator>::value_type` shall denote an
|
| 77 |
unsigned integer type capable of accommodating 32-bit quantities.
|
| 78 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 79 |
*Effects:* Does nothing if `begin == end`. Otherwise, with
|
| 80 |
s = `v.size()` and n = `end` - `begin`, fills the supplied range
|
| 81 |
[`begin`,`end`) according to the following algorithm in which each
|
| 82 |
operation is to be carried out modulo 2³², each indexing operator
|
| 83 |
applied to `begin` is to be taken modulo n, and T(x) is defined as
|
| 84 |
-
$x \
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 85 |
|
| 86 |
*Throws:* What and when `RandomAccessIterator` operations of `begin` and
|
| 87 |
`end` throw.
|
| 88 |
|
| 89 |
``` cpp
|
|
@@ -98,13 +140,15 @@ to `param()`.
|
|
| 98 |
``` cpp
|
| 99 |
template<class OutputIterator>
|
| 100 |
void param(OutputIterator dest) const;
|
| 101 |
```
|
| 102 |
|
| 103 |
-
*
|
| 104 |
-
|
| 105 |
-
|
|
|
|
|
|
|
| 106 |
|
| 107 |
*Effects:* Copies the sequence of prepared 32-bit units to the given
|
| 108 |
destination, as if by executing the following statement:
|
| 109 |
|
| 110 |
``` cpp
|
|
|
|
| 33 |
|
| 34 |
``` cpp
|
| 35 |
seed_seq();
|
| 36 |
```
|
| 37 |
|
| 38 |
+
*Ensures:* `v.empty()` is `true`.
|
|
|
|
| 39 |
|
| 40 |
*Throws:* Nothing.
|
| 41 |
|
| 42 |
``` cpp
|
| 43 |
template<class T>
|
| 44 |
seed_seq(initializer_list<T> il);
|
| 45 |
```
|
| 46 |
|
| 47 |
+
*Mandates:* `T` is an integer type.
|
| 48 |
|
| 49 |
*Effects:* Same as `seed_seq(il.begin(), il.end())`.
|
| 50 |
|
| 51 |
``` cpp
|
| 52 |
template<class InputIterator>
|
| 53 |
seed_seq(InputIterator begin, InputIterator end);
|
| 54 |
```
|
| 55 |
|
| 56 |
+
*Mandates:* `iterator_traits<InputIterator>::value_type` is an integer
|
|
|
|
|
|
|
| 57 |
type.
|
| 58 |
|
| 59 |
+
*Preconditions:* `InputIterator` meets the *Cpp17InputIterator*
|
| 60 |
+
requirements [[input.iterators]].
|
| 61 |
+
|
| 62 |
+
*Effects:* Initializes `v` by the following algorithm:
|
| 63 |
|
| 64 |
``` cpp
|
| 65 |
for (InputIterator s = begin; s != end; ++s)
|
| 66 |
v.push_back((*s) mod 2³²);
|
| 67 |
```
|
|
|
|
| 69 |
``` cpp
|
| 70 |
template<class RandomAccessIterator>
|
| 71 |
void generate(RandomAccessIterator begin, RandomAccessIterator end);
|
| 72 |
```
|
| 73 |
|
| 74 |
+
*Mandates:* `iterator_traits<RandomAccessIterator>::value_type` is an
|
|
|
|
|
|
|
| 75 |
unsigned integer type capable of accommodating 32-bit quantities.
|
| 76 |
|
| 77 |
+
*Preconditions:* `RandomAccessIterator` meets the
|
| 78 |
+
*Cpp17RandomAccessIterator* requirements [[random.access.iterators]] and
|
| 79 |
+
the requirements of a mutable iterator.
|
| 80 |
+
|
| 81 |
*Effects:* Does nothing if `begin == end`. Otherwise, with
|
| 82 |
s = `v.size()` and n = `end` - `begin`, fills the supplied range
|
| 83 |
[`begin`,`end`) according to the following algorithm in which each
|
| 84 |
operation is to be carried out modulo 2³², each indexing operator
|
| 85 |
applied to `begin` is to be taken modulo n, and T(x) is defined as
|
| 86 |
+
$x \xor (x \rightshift 27)$:
|
| 87 |
+
|
| 88 |
+
- By way of initialization, set each element of the range to the value
|
| 89 |
+
`0x8b8b8b8b`. Additionally, for use in subsequent steps, let
|
| 90 |
+
p = (n - t) / 2 and let q = p + t, where $$%
|
| 91 |
+
t = (n \ge 623) \mbox{ ? } 11 \mbox{ : } (n \ge 68) \mbox{ ? } 7 \mbox{ : } (n \ge 39) \mbox{ ? } 5 \mbox{ : } (n \ge 7) \mbox{ ? } 3 \mbox{ : } (n - 1)/2;$$
|
| 92 |
+
- With m as the larger of s + 1 and n, transform the elements of the
|
| 93 |
+
range: iteratively for k = 0, …, m - 1, calculate values
|
| 94 |
+
$$\begin{aligned}
|
| 95 |
+
r_1 & = &
|
| 96 |
+
1664525 \cdot T( \texttt{begin[}k\texttt{]}
|
| 97 |
+
\xor \texttt{begin[}k+p\texttt{]}
|
| 98 |
+
\xor \texttt{begin[}k-1 \texttt{]}
|
| 99 |
+
)
|
| 100 |
+
\\
|
| 101 |
+
r_2 & = & r_1 + \left\{
|
| 102 |
+
\begin{array}{cl}
|
| 103 |
+
s & \mbox{, } k = 0
|
| 104 |
+
\\
|
| 105 |
+
k \bmod n + \texttt{v[}k-1\texttt{]} & \mbox{, } 0 < k \le s
|
| 106 |
+
\\
|
| 107 |
+
k \bmod n & \mbox{, } s < k
|
| 108 |
+
\end{array}
|
| 109 |
+
\right.
|
| 110 |
+
|
| 111 |
+
\end{aligned}$$ and, in order, increment `begin[`k+p`]` by r₁,
|
| 112 |
+
increment `begin[`k+q`]` by r₂, and set `begin[`k`]` to r₂.
|
| 113 |
+
- Transform the elements of the range again, beginning where the
|
| 114 |
+
previous step ended: iteratively for k = m, …, m + n - 1, calculate
|
| 115 |
+
values $$\begin{aligned}
|
| 116 |
+
r_3 & = &
|
| 117 |
+
1566083941 \cdot T( \texttt{begin[}k \texttt{]}
|
| 118 |
+
+ \texttt{begin[}k+p\texttt{]}
|
| 119 |
+
+ \texttt{begin[}k-1\texttt{]}
|
| 120 |
+
)
|
| 121 |
+
\\
|
| 122 |
+
r_4 & = & r_3 - (k \bmod n)
|
| 123 |
+
|
| 124 |
+
\end{aligned}$$ and, in order, update `begin[`k+p`]` by xoring it with
|
| 125 |
+
r₃, update `begin[`k+q`]` by xoring it with r₄, and set `begin[`k`]`
|
| 126 |
+
to r₄.
|
| 127 |
|
| 128 |
*Throws:* What and when `RandomAccessIterator` operations of `begin` and
|
| 129 |
`end` throw.
|
| 130 |
|
| 131 |
``` cpp
|
|
|
|
| 140 |
``` cpp
|
| 141 |
template<class OutputIterator>
|
| 142 |
void param(OutputIterator dest) const;
|
| 143 |
```
|
| 144 |
|
| 145 |
+
*Mandates:* Values of type `result_type` are
|
| 146 |
+
writable [[iterator.requirements.general]] to `dest`.
|
| 147 |
+
|
| 148 |
+
*Preconditions:* `OutputIterator` meets the *Cpp17OutputIterator*
|
| 149 |
+
requirements [[output.iterators]].
|
| 150 |
|
| 151 |
*Effects:* Copies the sequence of prepared 32-bit units to the given
|
| 152 |
destination, as if by executing the following statement:
|
| 153 |
|
| 154 |
``` cpp
|