Export (0) Print
Expand All

std::shuffle

Visual Studio 2013

Shuffles (rearranges) elements for a given range by using a random number generator.

template<class RandomAccessIterator, class UniformRandomNumberGenerator>
void shuffle(RandomAccessIterator first,
    RandomAccessIterator last,
    UniformRandomNumberGenerator&& gen);

first

An iterator to the first element in the range to be shuffled, inclusive. Must meet the requirements of RandomAccessIterator and ValueSwappable.

last

An iterator to the last element in the range to be shuffled, exclusive. Must meet the requirements of RandomAccessIterator and ValueSwappable.

gen

The random number generator that the shuffle() function will use for the operation. Must meet the requirements of a UniformRandomNumberGenerator.

For more information, and a code sample that uses shuffle(), see <random>.

Header: <algorithm>

Namespace: std

Show:
© 2014 Microsoft