Looking for a thread safe random generator. I found the mersenne twister generator class, which the author says if the thread is safe:
http://www.umiacs.umd.edu/~yangcj/mtrnd.html
But after studying the code, which I do not see, it is a safe thread. It has no locks or anything like a lock variable.
Is this implementation truly thread safe? If so, what is magic?
It seems thread safe in the sense that two different MersenneTwist objects can be used at the same time. You cannot use the same object in two threads without protecting it with a lock.
, C , .
, Mersenne Twister Multiple stream Mersenne Twister, ( Fortran 95) http://theo.phys.sci.hiroshima-u.ac.jp/~ishikawa/PRNG/mt_stream_en.html. Mersenne Twister, , , . , , ; .