[Gretl-users] random number generation

Allin Cottrell cottrell at wfu.edu
Tue Nov 15 19:03:20 EST 2016

On Tue, 15 Nov 2016, Sven Schreiber wrote:

> Am 15.11.2016 um 18:16 schrieb Allin Cottrell:
>> Hello all,
>> Some news and a warning.
>> For some time now we've been using the Marsaglia-Tsang "Ziggurat"
>> algorithm for generating (pseudo-)random normal variates. Recently, Jack
>> noticed that we were considerably slower than Octave at doing this, so
>> we compared the respective codes.
>> It turned out that the Octave Ziggurat code (written by David Bateman)
>> was indeed better than what we had: not only faster, but also gives
>> denser coverage of the real line. We checked it using l'Ecuyer's "Big
>> Crush" suite and it passed with flying colors. Therefore in current git
>> we have switched to Bateman's implementation.
> Thanks -- could you perhaps also comment on the comparison in this (not brand 
> new) talk by Dirk Eddelbüttel:
> http://dirk.eddelbuettel.com/papers/useR2014_rcppziggurat.pdf
> Check out slide number 11 (or 13, depending on the counting), where 
> "ZiggGretl" appears.

I don't have much to say about that reference since I'm not sure 
from looking at Dirk's slides how the timings were obtained. That 
said, I can say that my timings for 200 replications of (1 million 
random normals) show R's rnorm() function -- from the current R 
release -- as taking about 5 times as long as gretl and Octave. 
Not in the ballpark.

As regards gretl vs Octave, we're now a little faster (using 
basically the same normals code, but gretl's generation of the 
underlying uniform variates is faster).

Maybe Dirk is using a "souped up" alternative to R's standard 
rnorm(). That wasn't clear to me.


More information about the Gretl-users mailing list