19 Mar
2015
19 Mar
'15
8:43 p.m.
Andrey Semashev wrote:
I was looking at random_device. Now that I look at other generators, they don't use it, so my worries are probably unfounded.
random_device is overkill here. You can get a reasonably random seed by, f.ex. rand() + ( rand() << 15 ), and then create a local RNG from it. The Boost.Random page listing the generators says that taus88 is 6 times faster than minstd_rand, which is the usual implementation of rand(). And it has only three words of state, so constructing it can't be expensive.