I'm a little worried about my seeds.
Since you say you're using C++11, you could seed the generator from std::random_device
, which will use a source of true randomness if possible, and give (hopefully) good pseudorandom numbers otherwise.
(By the way, if you're using C++11, then all of this is now in the standard <random>
library, so there's no need for Boost).
I haven't seeded the mt19937 object in the initializer because I don't have num yet.
You could change the member order so that num
is initialised first. Of course, that's irrelevant if you use std::random_device
.
Is it ok to have all these different random number generators or should I be using a single one that's shared between all the objects?
The randomness is probably no worse, but I'm not enough of an expert in such things to say for sure. It does seem rather wasteful, since each generator has a few kilobytes of state.
If sharing a single one is better, how do I handle the different mean/variance values for each object?
You can have multiple variate generators using different distrubutions but the same underlying generator.
WARNING: don't use this in a real gambling machine. The Mersenne Twister generator is not suitable for cryptography, as described here.