random_shuffle
uses an implementation-defined random number generator unless you provide one. So, no, using srand
is not necessarily correct.
Otherwise it uses the generator you provide. You can use rand
if you want to be sure that is what gets used.
srand(seed);
std::random_shuffle(first, last, [](int n) { return rand() % n; });
// this is a biased generator
// see <http://eternallyconfuzzled.com/arts/jsw_art_rand.aspx>
However, I recommend using the new <random>
facilities instead of rand(). Example follows.
std::default_random_engine gen(seed);
std::shuffle(first, last, gen);