title: C++ computationaly efficient and threadsafe random function
body: <p>I recently learned <a href="https://stackoverflow.com/q/8200272/574733">the hard way</a> that <code>#&lt;cstdlib&gt; rand()</code> is not thread safe, and on Linux is implemented with mutexes, causing a bottleneck when <code>rand()</code> is called frequently by multiple threads. <code>rand_r</code> works as a replacement, but there are <a href="http://www.evanjones.ca/random-thread-safe.html" rel="nofollow noreferrer">concerns</a> about the quality of random number generation. Moreover, this situation has caused me to question whether there might be faster random number generators out there, since apparently my code spends a lot of time generating random numbers. There are a few alternatives listed in the link above, but I'm unsure as to their speed and to what other alternatives might be out there.</p>