
The still
very new package
zigg which
arrived on
CRAN a week ago just
received a micro-update at
CRAN.
zigg provides
the
Ziggurat
pseudo-random number generator (PRNG) for Normal, Exponential and
Uniform draws proposed by
Marsaglia and
Tsang
(JSS, 2000),
and extended by Leong et al.
(JSS, 2005). This PRNG
is lightweight and
very fast: on my machine speedups for the
Normal, Exponential, and Uniform are on the order of 7.4, 5.2 and 4.7
times faster than the default generators in
R as illustrated in the benchmark
chart borrowed from the
git repo.
As wrote last week in the
initial
announcement, I had picked up their work in package
RcppZiggurat
and updated its code for the 64-buit world we now live in. That package
alredy provided the Normal generator along with several competing
implementations which it compared rigorously and timed them. As one of
the generators was based on the
GNU GSL via the
implementation of
Voss, we always ended
up with a run-time dependency on the GSL too. No more: this new package
is zero-depedency, zero-suggsts and hence
very easy to deploy.
Moreover, we also include a demonstration of four distinct ways of
accessing the compiled code from another R package: pure and straight-up
C, similarly pure C++, inclusion of the header in C++ as well as via
Rcpp. The other advance is the
resurrection of the second generator for the Exponential distribution.
And following
Burkardt we expose the
Uniform too. The main upside of these generators is their excellent
speed as can be seen in the comparison the default R generators
generated by the example script
timings.R:
Needless to say, speed is not everything. This PRNG comes the time of
32-bit computing so the generator period is likely to be shorter than
that of newer high-quality generators. If in doubt, forgo speed and
stick with the high-quality default generators.
This release essentially just completes the DESCRIPTION file and
README.md now that this is a
CRAN package. The short NEWS entry
follows.
Changes in version 0.0.2
(2025-02-07)
- Complete DESCRIPTION and README.md following initial CRAN
upload
Courtesy of my
CRANberries, there
is a
diffstat
report relative to previous release. For more information, see the
package page
or the
git repo.
This post by Dirk
Eddelbuettel originated on his Thinking inside the box
blog. If you like this or other open-source work I do, you can sponsor me at
GitHub.