permutation function

Hi, I want to write a function that will choose say m of the members of an array with n members, randomly. Could anyone help please?
Last edited on
I think you should use expression std::rand() % n in a loop with m iterations.
1. Shuffle the array randomly http://en.cppreference.com/w/cpp/algorithm/random_shuffle
2. Pick the first 'm' members
Thanks JLBorges, it solved my problem.
Topic archived. No new replies allowed.