Here's some C++ source code for a PRNG (pseudorandom number generator) which uses guarded access to the kernel's /dev/urandom device. It is not very fast, even if the spinlocks are removed and the PRNG is run only by a single thread. But the output is of very high quality.
Have you seen the new PRNG support in C++11 by any chance? The standard library now contains quite a few PRNGs, and many helper functions to use them to draw from many different types of distributions. And everything is portable.
std::random_device is an interface to OS-specific random number generators (probably /dev/urandom on Linux).
Disclosure: I work for DeepMind on the AlphaZero project, but everything I say here is personal opinion and does not reflect the views of DeepMind / Alphabet.
matthewlai wrote:Have you seen the new PRNG support in C++11 by any chance?
Alas, I must code using a dialect supported on all my machines, and C++11 is too much for some of them.
That's unfortunate . Cannot upgrade GCC on those machines? Or are they Windows?
Disclosure: I work for DeepMind on the AlphaZero project, but everything I say here is personal opinion and does not reflect the views of DeepMind / Alphabet.
Yes, modern VS supports C++11 very well. I mentioned Windows because I know modern VS doesn't run on older Windows versions, and modern Windows also doesn't run on older hardware.
As you can see from that table, even VS 2012 is missing many commonly used features, so 2013 is the first version that has more or less complete support.
That's not true for the most part for Linux for example, where even very old machines can run recent distributions.
Disclosure: I work for DeepMind on the AlphaZero project, but everything I say here is personal opinion and does not reflect the views of DeepMind / Alphabet.
matthewlai wrote:That's unfortunate . Cannot upgrade GCC on those machines? Or are they Windows?
They include older Macs dating back to the year 2000.
Mostly only Macs made since 2009 are able to include C++11 in the tool chain.
Ah I see.
For Macs that old, would it be a good idea to convert them to Linux instead? That way they can still get all the new stuff.
Ubuntu no longer officially supports PowerPC, but it's still community-supported, and has all the latest software.
Latest Debian still officially supports PPC.
Disclosure: I work for DeepMind on the AlphaZero project, but everything I say here is personal opinion and does not reflect the views of DeepMind / Alphabet.
I programmed Symbolic to have its random game generator use the new PRNG.
A random game generation calls the PRNG an average of about 334 times. So a million random games needs about 3.4e+8 such calls. Here's the output of a million game request on a old 2.66GHz quad core machine (four threads):