mozilla/rust — pull request #10099 by huonw (2013-10-27 10:33:57+00:00)
Title: std::rand: substitute an unbiased Exp1 temporarily.

The Ziggurat implementation of Exp1 is incorrect: it appears to have an
expected value of around 0.994 rather than 1 and the density of a large
number of sample means does not match the normal distribution expected
by the central limit theorem (specifically, it's a normal distribution
centred at 0.994).

This replaces Ziggurat with a "plain" inverse-cdf implementation for
now. This implementation has the expected properties, although it is
approximately 4 times slower (56 seconds rather than 16 to generate
1 billion samples).

cc #10084 (this does *not* fix it).

Re-plot of the density estimate of 10000 sample means where each mean is over 100000 samples:

![cdf-exp-density](https://f.cloud.github.com/assets/1203825/1415307/a39115f4-3ef2-11e3-9fd0-c3b532c3fe1d.png)

Clearly it matches far closer than the old implementation (cf. the plot in #10084, the scales are approximately the same).

Note: I'm going to investigate & fix the problem with the Ziggurat implementation, this is just temporary so that the implementation is correct.