I have a program that uses the mt19937 random number generator from boost::random. I need to do a random_shuffle and want the random numbers generated for this to be from th
I'm using tr1 instead of boost::random here, but should not matter much.
The following is a bit tricky, but it works.
#include #include std::tr1::mt19937 engine; std::tr1::uniform_int<> unigen; std::tr1::variate_generator >gen(engine, unigen); std::random_shuffle(vec.begin(), vec.end(), gen);