14 Nov
2010
14 Nov
'10
7:19 p.m.
AMDG On 11/14/2010 7:03 AM, Juan Antonio Farré Basurte wrote:
Are random number generators thread safe? Can I use a random number generator by multiple threads without explicit locking?
No.
I guess the answer is no... Then I wonder if every thread could use a different instance of the same random number generator without interference between the different generators.
I guess the answer is yes for pseudorandom generators. But what about real random generators? If I have different instances of one, they all have to access the same source of randomness (maybe hardware). Will they synchronize transparently?
random_device reads from /dev/urandom. I assume that this is safe. In Christ, Steven Watanabe