T
Thomas
I hope someone more experienced than I am can help me with this. I'm
trying to let std::random_shuffle work with a different random number
generator (different from the built-in one). I am using a small library
based on the Mersenne Twister, with a header "randomc.h" and a source
file mersenne.cpp as include directives. I declared
int32 seed = time(0);
TRandomMersenne rg(seed);
outside main() to enable global scope. This works fine as far as
generating integers or doubles is concerned. As I said, I'd like to use
this rng with the random_shuffle algorithm. As I understand it, the
following code should do the job:
std::random_shuffle (vint.begin(), vint.end(), rg);
- but it doesn't. The third parameter should be a "predicate functor",
and apparently rg doesn't qualify as such. What am I doing wrong?
Thanks,
Thomas
trying to let std::random_shuffle work with a different random number
generator (different from the built-in one). I am using a small library
based on the Mersenne Twister, with a header "randomc.h" and a source
file mersenne.cpp as include directives. I declared
int32 seed = time(0);
TRandomMersenne rg(seed);
outside main() to enable global scope. This works fine as far as
generating integers or doubles is concerned. As I said, I'd like to use
this rng with the random_shuffle algorithm. As I understand it, the
following code should do the job:
std::random_shuffle (vint.begin(), vint.end(), rg);
- but it doesn't. The third parameter should be a "predicate functor",
and apparently rg doesn't qualify as such. What am I doing wrong?
Thanks,
Thomas