Boost logo

Boost Users :

Subject: [Boost-users] [random]how to initialise a rng for use in the initialiser list?
From: Moritz Beber (moritz.beber_at_[hidden])
Date: 2008-11-21 22:47:37


Hello again,

sorry for the many questions to this list right now, I'm just beginning
to use boost. This time I have some issues regarding the boost.random
usage.

I have used it just fine for many examples but there's one tricky bit
that I was wondering whether anyone of you knows a solution for.

I use a class which keeps the random number generator around as a member
variable; this class also has a const matrix. Now in the constructor of
the class I do something like:

my_class::my_class(args) : rng(seed), matrix(initialise()), ...
{
        ...
}

Of course, I want to use the rng to initialise the matrix and that's
where things fail. I guess, I could use a different rng just to fill the
matrix, or make it non-const and fill it in the constructor body. But
does anyone know a neat trick to do this in the way proposed?

Thank you for any answers,

Moritz


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