
Hi,
I must be missing something basic as my use of random_vertex returns always
the same vertex each time I run the code (which is listed below).
Help would be much appreciated. I'm using MSVC 7.1 and boost 1.32 on windows
XP.
TIA,
Rui
#include <iostream>
#include

Rui Carvalho wrote:
Sure, because the random number generator is initialized with the same seed on each invocation. You can seed it with current time or something like that. Note however, that you'll need to output the seed and have an option to specify it manually, if you want to be able to debug anything. If you're using random_vertex for some testing, I'd recommend not using seed and just running the tests several times. The sequence of vertices will be always the the same, but still sufficiently "random". - Volodya

Vladimir Prus wrote:
Thanks for this. Is there anything on the docs/examples on how to initialize the random number generator? I mean, boost/random/mersenne_twister.hpp seems to be an adaptation of the original Mersenne Twister by Matsumoto and Nishimura -is it the same as the original? Thanks, Rui

Rui Carvalho wrote:
http://boost.org/libs/random/random-generators.html#mersenne_twister
mentions this method:
void seed(DataType value);
I think passing the result of time:
#include
I don't know, sorry. - Volodya
participants (3)
-
Doug Gregor
-
Rui Carvalho
-
Vladimir Prus