RcppZiggurat v0.1.3


Monthly downloads



'Rcpp' Integration of Different "Ziggurat" Normal RNG Implementations

The Ziggurat generator for normally distributed random numbers, originally proposed by Marsaglia and Tsang (JSS, 2000), has been improved upon a few times starting with Leong et al (JSS, 2005). This package provides an aggregation in order to compare different implementations. The goal is to provide an 'faster but good enough' alternative for use with R and C++ code. The package is still in an early state. Unless you know what you are doing, sticking with the generators provided by R may be a good idea as these have been extremely diligently tested.


RcppZiggurat Build Status License CRAN Downloads

Rcpp Bindings for Ziggurat RNGs


The RcppZiggurat package regroups a number of implementations of the 'Ziggurat' random number generator by Marsaglia and Tsang (JSS, 2000), both in the original version and via the update by Leong, Zhang, Lee, Luk and Villasenor (JSS, 2005).

The purpose of the package is to both study and time these implementations in order to provide a fast N(0,1) generator for use by R. The generators included in R are excellent and very diligently implemented, but not generally the fastest. This package aims to close the performance gap.

You should know what you are doing when deploying this package. If in doubt, stick with the default generators.


The package contains a detailed vignette summarizing the methods, the implementation as well as the statistical properties (examined via three different tests) and the generator speed.


The package currently contains six different implementations. Two are standard from the literature: the original Marsaglia and Tsang approach (which should not be used as the resulting generator has be improved as suggested by Leong et al.), the improved Leong et al variant, a version from the GNU GSL, a version from the GNU Gretl econometric program as well as a version from QuantLib.


The package contains several demo scripts. Try

R> demo(package="RcppZiggurat")


More testing never hurts, ...

More generators as e.g. the modified Ziggurat implementation suggested by Doornik (though his code is not under an open source licence)


Dirk Eddelbuettel


GPL (>= 2)

Functions in RcppZiggurat

Name Description
RcppZiggurat-package Collection and comparison of different Ziggurat RNGs
zrnorm Collection of Ziggurat Normal RNGs
No Results!

Vignettes of RcppZiggurat

No Results!

Last month downloads


Type Package
Date 2015-07-25
License GPL (>= 2)
VignetteBuilder highlight
LinkingTo Rcpp, RcppGSL
NeedsCompilation yes
Packaged 2015-07-26 01:06:28.219544 UTC; edd
Repository CRAN
Date/Publication 2015-07-26 09:11:22

Include our badge in your README