Random numbers have been well covered here, so I’ll keep it brief.
I use srand and rand to generate some deterministic random numbers in a simulation. However, when running multiple simulations at once on separate threads, the individual sequence gets muddled up and becomes non deterministic, because all threads draw from the same pool. Is there an easy way to “bind” rand to draw from a specific instance? Or would I have to switch to something like Boost.Random?
Your compiler most likely already has something very like Boost.Random.
C++0x includes a
<random>header which is based on Boost.Random (with a few tweaks here and there).Before then, TR1, a set of “semi-standard” libraries was available for most compilers as well, which contains nearly the same
<random>header.