Boost logo

Boost :

From: nbecker_at_[hidden]
Date: 2001-04-03 09:40:51


I just noticed a problem with the design of the random number
generators.

It is typical to need multiple generators within one program. A good
way to ensure independence is to share a single underlying uniform
generator.

It doesn't look like random.hpp is designed to allow this.private:

for example,

class normal_distribution {
...
  uniform_01<base_type, RealType> _rng;

So _rng will be a copy of the rng passed. It appears to me that the
copy will not share all the state of the uniform generator passed in.
For example, if mersenne_twister is used, at least the variable "i"
will be independently incremented by each instance of
normal_distribution.

Wouldn't it be better if _rng was a reference to allow for shared
state?


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk