[alg.random.shuffle] (original) (raw)

26 Algorithms library [algorithms]

26.7 Mutating sequence operations [alg.modifying.operations]

26.7.13 Shuffle [alg.random.shuffle]

Preconditions: For the overload in namespace std:

Effects: Permutes the elements in the range [first, last) such that each possible permutation of those elements has equal probability of appearance.

Returns: last for the overloads in namespace ranges.

Complexity: Exactly (last - first) - 1 swaps.

Remarks: To the extent that the implementation of this function makes use of random numbers, the object referenced by g shall serve as the implementation's source of randomness.