tmp/tmpo1d9qxbf/{from.md → to.md}
RENAMED
|
@@ -3,24 +3,35 @@
|
|
| 3 |
``` cpp
|
| 4 |
template<class RandomAccessIterator, class UniformRandomBitGenerator>
|
| 5 |
void shuffle(RandomAccessIterator first,
|
| 6 |
RandomAccessIterator last,
|
| 7 |
UniformRandomBitGenerator&& g);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
```
|
| 9 |
|
| 10 |
-
*
|
| 11 |
-
|
| 12 |
-
`
|
| 13 |
-
requirements
|
| 14 |
-
|
| 15 |
-
|
| 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.
|
| 26 |
|
|
|
|
| 3 |
``` cpp
|
| 4 |
template<class RandomAccessIterator, class UniformRandomBitGenerator>
|
| 5 |
void shuffle(RandomAccessIterator first,
|
| 6 |
RandomAccessIterator last,
|
| 7 |
UniformRandomBitGenerator&& g);
|
| 8 |
+
|
| 9 |
+
template<random_access_iterator I, sentinel_for<I> S, class Gen>
|
| 10 |
+
requires permutable<I> &&
|
| 11 |
+
uniform_random_bit_generator<remove_reference_t<Gen>>
|
| 12 |
+
I ranges::shuffle(I first, S last, Gen&& g);
|
| 13 |
+
template<random_access_range R, class Gen>
|
| 14 |
+
requires permutable<iterator_t<R>> &&
|
| 15 |
+
uniform_random_bit_generator<remove_reference_t<Gen>>
|
| 16 |
+
borrowed_iterator_t<R> ranges::shuffle(R&& r, Gen&& g);
|
| 17 |
```
|
| 18 |
|
| 19 |
+
*Preconditions:* For the overload in namespace `std`:
|
| 20 |
+
|
| 21 |
+
- `RandomAccessIterator` meets the *Cpp17ValueSwappable*
|
| 22 |
+
requirements [[swappable.requirements]].
|
| 23 |
+
- The type `remove_reference_t<UniformRandomBitGenerator>` meets the
|
| 24 |
+
uniform random bit generator [[rand.req.urng]] requirements.
|
| 25 |
|
| 26 |
*Effects:* Permutes the elements in the range \[`first`, `last`) such
|
| 27 |
that each possible permutation of those elements has equal probability
|
| 28 |
of appearance.
|
| 29 |
|
| 30 |
+
*Returns:* `last` for the overloads in namespace `ranges`.
|
| 31 |
+
|
| 32 |
*Complexity:* Exactly `(last - first) - 1` swaps.
|
| 33 |
|
| 34 |
*Remarks:* To the extent that the implementation of this function makes
|
| 35 |
+
use of random numbers, the object referenced by `g` shall serve as the
|
| 36 |
implementation’s source of randomness.
|
| 37 |
|