[Computer-go] fast + good RNG

Darren Cook darren at dcook.org
Sun Mar 29 04:01:15 PDT 2015

> I measured that std::mt19937_64 (the mersenne twister from the standard
> c++ libraries) uses about 40% cpu time during playouts.
> So I wonder: is there a faster prng while still generating good enough
> random?

This question suggests some:

This question is not that useful, but contains links to more information
on alternative random algorithms, and a link to a video presentation:

Random number generation in multi-threaded programs is an interesting
topic, and worth being aware of. (E.g. you don't want to use 16 threads,
only to find all 16 generate the same random sequence, so each thread
generates the same playout as all the other threads.)
(See the example of using thread_local in
http://codereview.stackexchange.com/a/84112 )

40% sounds high. Are you re-initializing the generator each time you
need a new random number?


Darren Cook, Software Researcher/Developer
My new book: Data Push Apps with HTML5 SSE
Published by O'Reilly: (ask me for a discount code!)
Also on Amazon and at all good booksellers!

More information about the Computer-go mailing list