|
Boost Users : |
From: Tim Keitt (tkeitt_at_[hidden])
Date: 2008-03-25 14:53:04
Hans Mull <hans72mull <at> aol.com> writes:
>
> Hi!
> How can I use random generators with multiple parameters such as
> linear_congruential with parameters that are only known at runtime?
>
> Thanks in advance, Hans
>
I've often wondered this myself (not the how, but the why). This is a rather odd
feature of the Boost Random library. Most libraries would have a function list
"rnorm(mean, std)" which would return a random deviate with the specified mean
and standard deviation. Changing these at runtime is important for many kinds of
simulation. You can of course define these yourself eg
double rnorm(double mean, double std)
{
return std * rnorm01() + mean;
}
where rnorm01() returns deviates with unit scaling and zero mean. This works if
the scaled distribution is affine to the original, but does not work otherwise
(if the distribution changes shape with the parameters).
This is an area where Boost Random needs some TLC. Good idea for a SoC project!
THK
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