I use boost::randomto generate random velocity values, and I want to change the average and variance in response to user input.
I am using the following:
typedef boost::mt19937 RNG;
static RNG rng();
typedef boost::normal_distribution<double> DIST;
DIST dist_east(vel_e, sigma);
DIST dist_north(vel_n, sigma);
boost::variate_generator<RNG, DIST> east(rng, dist_east);
boost::variate_generator<RNG, DIST> north(rng, dist_north);
velocity.east = east();
velocity.north = north();
My problem is that I get only one value returned from two variable generators each time it is called. The values change when vel_e, vel_n or sigma changes, but otherwise I get the same value.
I tried to make dist_east, dist_north, east and north objects static, but I cannot change the parameters after building.
Is there any way to achieve what I want?
source
share