Boost logo

Boost Users :

From: Vladimir Prus (ghost_at_[hidden])
Date: 2004-12-08 07:35:33


Rui Carvalho wrote:

> 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).

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


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net