2 ms·
I think it's pretty common. Here's a note I wrote regarding Luc Devroye's highly-regarded (and excellent!) book on univariate random number generation: Althou
by mturmon 13y ago
I think it's pretty common. Here's a note I wrote regarding Luc Devroye's highly-regarded (and excellent!) book on univariate random number generation:
Although not dissenting from the other reviews which tout the comprehensiveness of the treatment and its level of detail, I have to add an unpleasant fact about the algorithms: the codes may not work as written, and if they don't, there's not an easy way to track down the problem. (This is because of the nature of the constructions used in the complex constant-time algorithms -- this opaqueness is not a problem for the elementary algorithms which, alas, may not run in constant time.)
A look at the author's web site (currently at errors.pdf off his main page) shows that, e.g., the algorithm on page 511 [of the book] for Poisson r.v.'s has four serious bugs as originally published. This means that the main algorithm for one of the most important discrete distributions was not coded and tested by the author before the book appeared!
In fact, I believe this algorithm has at least one more bug, because I'm still seeing a small off-by-one anomaly in my implementation. The algorithm for binomial r.v.'s may have trouble as well -- I see problems for N=400, p=0.05. After 10 million draws (i.e., enough to get good statistics) I see deviations of counts in some bins near the peak (i.e. number of integer outcomes of the R.V.) of 8 standard deviations from the expected number of counts. So, be careful, and consider alternate implementations of the more complex algorithms.
There's a lot of detail in the book, and the techniques are valid. But as we all know, implementation sometimes reveals algebra errors!