Boost logo

Boost Users :

From: klapshin (klapshin_at_[hidden])
Date: 2002-05-21 13:51:27


Hello All!

I just started using boost/random project, and kind of confused with
behavior of random::mersenne_twister constructor and seed method.
The thing is that both of them have two flavors -- first accepting
DataType, while second is template method accepting Generator.
The problem is when I am trying innocent

boost::mt19937 rng(999);
//and/or
rng.seed(999);

wrong ctor/seed being invoked and I am getting far from crystal clear
error message (term does not evaluate to a function).
The problem is quite obvious: 999 is of type int, while DataType by
default is unsigned long on my platform, so template version of
ctor/seed picks this call, and it is failing since 999 is not a
generator.

So I have to write something like:

boost::mt19937 rng(boost::mt19937::result_type(999));

which is kind of cumbersome.

Why generator version of seed is not named differently? Say seed_gen?
Don't know what to do with constructor though.

PS: I am using boost_1_28_0, and MSVC 6.0.

Best regards,
   Kirill Lapshin.


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