tmp/tmpfyf1wb8_/{from.md → to.md}
RENAMED
|
@@ -1,24 +1,25 @@
|
|
| 1 |
### Shuffle <a id="alg.random.shuffle">[[alg.random.shuffle]]</a>
|
| 2 |
|
| 3 |
``` cpp
|
| 4 |
-
template<class RandomAccessIterator, class
|
| 5 |
void shuffle(RandomAccessIterator first,
|
| 6 |
RandomAccessIterator last,
|
| 7 |
-
|
| 8 |
```
|
| 9 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
*Effects:* Permutes the elements in the range \[`first`, `last`) such
|
| 11 |
that each possible permutation of those elements has equal probability
|
| 12 |
of appearance.
|
| 13 |
|
| 14 |
-
*Requires:* `RandomAccessIterator` shall satisfy the requirements of
|
| 15 |
-
`ValueSwappable` ([[swappable.requirements]]). The type
|
| 16 |
-
`UniformRandomNumberGenerator` shall meet the requirements of a uniform
|
| 17 |
-
random number generator ([[rand.req.urng]]) type whose return type is
|
| 18 |
-
convertible to `iterator_traits<RandomAccessIterator>::difference_type`.
|
| 19 |
-
|
| 20 |
*Complexity:* Exactly `(last - first) - 1` swaps.
|
| 21 |
|
| 22 |
*Remarks:* To the extent that the implementation of this function makes
|
| 23 |
use of random numbers, the object `g` shall serve as the
|
| 24 |
implementation’s source of randomness.
|
|
|
|
| 1 |
### Shuffle <a id="alg.random.shuffle">[[alg.random.shuffle]]</a>
|
| 2 |
|
| 3 |
``` cpp
|
| 4 |
+
template<class RandomAccessIterator, class UniformRandomBitGenerator>
|
| 5 |
void shuffle(RandomAccessIterator first,
|
| 6 |
RandomAccessIterator last,
|
| 7 |
+
UniformRandomBitGenerator&& g);
|
| 8 |
```
|
| 9 |
|
| 10 |
+
*Requires:* `RandomAccessIterator` shall satisfy the requirements of
|
| 11 |
+
`ValueSwappable` ([[swappable.requirements]]). The type
|
| 12 |
+
`remove_reference_t<UniformRandomBitGenerator>` shall meet the
|
| 13 |
+
requirements of a uniform random bit generator ([[rand.req.urng]]) type
|
| 14 |
+
whose return type is convertible to
|
| 15 |
+
`iterator_traits<RandomAccessIterator>::difference_type`.
|
| 16 |
+
|
| 17 |
*Effects:* Permutes the elements in the range \[`first`, `last`) such
|
| 18 |
that each possible permutation of those elements has equal probability
|
| 19 |
of appearance.
|
| 20 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
*Complexity:* Exactly `(last - first) - 1` swaps.
|
| 22 |
|
| 23 |
*Remarks:* To the extent that the implementation of this function makes
|
| 24 |
use of random numbers, the object `g` shall serve as the
|
| 25 |
implementation’s source of randomness.
|