28 Algorithms library [algorithms]

28.6 Mutating sequence operations [alg.modifying.operations]

28.6.13 Shuffle [alg.random.shuffle]

template<class RandomAccessIterator, class UniformRandomBitGenerator> void shuffle(RandomAccessIterator first, RandomAccessIterator last, UniformRandomBitGenerator&& g);
Requires: RandomAccessIterator shall satisfy the requirements of ValueSwappable ([swappable.requirements]).
The type remove_­reference_­t<UniformRandomBitGenerator> shall meet the requirements of a uniform random bit generator ([rand.req.urng]) type whose return type is convertible to iterator_­traits<RandomAccessIterator>​::​difference_­type.
Effects: Permutes the elements in the range [first, last) such that each possible permutation of those elements has equal probability of appearance.
Complexity: Exactly (last - first) - 1 swaps.
Remarks: To the extent that the implementation of this function makes use of random numbers, the object g shall serve as the implementation's source of randomness.