It seems that one can use the following code to produce random numbers from a particular Normal distribution:
float mean = 0, variance = 1;
boost::mt19937 randge
Your hypothesis is correct. You want both variate_generator
instances to use the same random number generator instance. So use a reference to mt19937
as your template parameter.
variate_generator > nD(randgen, noise1);
variate_generator > nC(randgen, noise2);
Obviously you'll have to ensure randgen
does not go out of scope before nD
and nC
do.