#include #include #include #include #include //From http://www.richelbilderbeek.nl/CppRandomShuffle.htm int main() { //Create a std::vector std::vector(v); //Fill it with 10 values for (int i=0; i!=10; ++i) v.push_back(i); //Show it on screen std::cout << "Before shuffling: " << std::endl; std::copy(v.begin(),v.end(),std::ostream_iterator(std::cout,"\n")); //Shuffle it std::random_shuffle(v.begin(),v.end()); //Show it on screen std::cout << "After shuffling: " << std::endl; std::copy(v.begin(),v.end(),std::ostream_iterator(std::cout,"\n")); //Wait for a key std::cin.get(); }