3 ms·
Even if you pretend that you always have a free core available for precomputing a stream of random numbers, accessing them is more expensive than a copy -- you
by cperciva 18y ago
Even if you pretend that you always have a free core available for precomputing a stream of random numbers, accessing them is more expensive than a copy -- you need to have locking in place to make sure that you don't give two people the same random numbers.
(You could pregenerate per-CPU pools of random numbers, but then you have a different synchronization problem: You need to make sure that you don't migrate to a different CPU between looking up which CPU you're on and reading the random numbers.)