random_shuffle

Syntax:

    #include <algorithm>
    void random_shuffle( iterator start, iterator end );
    void random_shuffle( iterator start, iterator end, RandomNumberGenerator& rnd );

The random_shuffle() function randomly re-orders the elements in the range [start,end). If a random number generator function object rnd is supplied, it will be used instead of an internal random number generator.

The “internal” random number generator is not necessarily the one which can accessed with rand() and seeded with srand(); this is implementation defined. The SGI STL implementation, for example, uses a different generator.

Related Topics: next_permutation, prev_permutation, random_sample, random_sample_n