random_shuffle()
By default, random_shuffle() reorders the elements randomly based on its own algorithm. An optional third parameter allows us to pass in a random-number-generating operation that must return a value of type double within the interval [0,1].
#include <algorithm> random_shuffle( ivec.begin(), ivec.end() );
Get Essential C++ now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.