Flame bait: D vs. Rust vs. Go Benchmarking

Joseph Rushton Wakeling joseph.wakeling at webdrake.net
Wed Jul 24 12:17:10 PDT 2013


On Wednesday, 24 July 2013 at 11:32:17 UTC, bearophile wrote:
> Compiling with LDC2 I have found Xorshift about as fast as C 
> rand :-)

Excellent! I'm away from computer for a week so couldn't check 
myself.

> So I suggested to make Xorshift the default one, but people 
> rightly answered the standard one should be the safe (this 
> means good) generator. On the other hand a note in the Phobos 
> docs is a good idea.

The bug with Xorshift that was the real blocker here has been 
fixed. As far as defaults go, though, Mersenne Twister still has 
overall better statistical quality (though Xorshift is good -- it 
fails only the strictest tests of randomness). MT is also 
something of an "industry standard" for quality random number 
generation.

If I recall right there was a suggestion that the default RNG 
type Random should be target-dependent, so e.g. for a low-powered 
device it might be better to make Xorshift the default.

There have also been some other RNGs developed recently that 
match Xorshift for speed but have better statistical properties. 
I have the papers and it's probably worth looking into adding 
these to Phobos.


More information about the Digitalmars-d mailing list