SuppDists (version 1.0-0)

ziggurat: The Ziggurat normal and exponential generator

Description

Generates normal and exponential random pseudo-random numbers by the method of Marsaglia and Tsang.

Usage

rziggurat(n, normal=TRUE, new.start=FALSE, seed=556677)

Arguments

n
number of values to generate. If n is a vector, length(n) values will be generated
normal
logical scalar; if TRUE normal values are produced, otherwise exponential values
new.start
logical scalar. If TRUE the generator will be started afresh using the seed
seed
scalar 32 bit starting integer

Value

  • Generates a vector of pseudo random numbers in the range 0 to 1.

References

Marsaglia, George, and Tsang, Wai Wan. 2000. The Ziggurat method for generating random variables. Journal of Statistical software. 5-8. http://www.jstatsoft.org/v05/i08/

Examples

Run this code
rziggurat(50,new.start=TRUE)
rziggurat(50)
rziggurat(50,new.start=TRUE)

Run the code above in your browser using DataCamp Workspace