The following program can demonstrates you that how to use the random_shuffle() function in the programming of the C++ language while doing the coding using the random_shuffle() function as shown below :
Code:
include <iostream>
include <algorithm>
include <cstdlib>
include <ctime>
int Rndm(int m)
{
return rnd() % m ;
}
int main()
{
std::srnd(std::time(0));
int Nmbrs[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
std::random_shuffle(Nmbrs, Nmbrs + 10, Rndm);
for(int i=0;i<10;++i)
std::cout<<Nmbrs[i]<<" ";
return 0;
}
Bookmarks