On 19 Mar 2015 at 19:33, Stephan T. Lavavej wrote:
[STL]
(mt19937 is awesome, but at 5 KB I'd be slightly nervous about making it thread_local.)
[Steven Watanabe]
boost::mt19937 is only 2.5 KB.
Thanks - I see where the factor of 2 is coming from, although it'll need a bit more thought to untangle. I've filed a bug in our internal database.
Anyone considering using mt19937 should be aware it was painfully slow on ARM where it used the generic C implementation. I use the past tense because I don't know the current state of things having excised all uses of Mersenne from my code as a result - nevertheless, Mersenne is only awesome on Intel, and a similar dog slow speed to a crypto random source on some other CPUs. Personally speaking if I need portable, fast, not awful randomness, I like http://burtleburtle.net/bob/rand/smallprng.html. It's much faster to initialise than mersenne too, runs very well on all CPUs without special opcodes, but the output isn't quite as random. As a rand() replacement it ought to be plenty fine, a 2^126 average period is plenty. Niall -- ned Productions Limited Consulting http://www.nedproductions.biz/ http://ie.linkedin.com/in/nialldouglas/