rziggurat: The Ziggurat normal and exponential generator.

Description Usage Arguments Value Note Author(s) References Examples

Description

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

Usage

1
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 real pseudo random numbers.

Note

This function does not work properly on LP64 machines which use 64 bit longs.

This implementation running in is approximately three times as fast as rnorm().

Author(s)

Bob Wheeler bwheelerg@gmail.com

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

1
2
3
rziggurat(50, new.start=TRUE)
rziggurat(50)
rziggurat(50, new.start=TRUE)

andrie/SuppDists documentation built on May 10, 2019, 11:18 a.m.