Learn R Programming

setRNG (version 2004.4-1)

setRNG: Set the Random Number Generator

Description

Set the RNG or return information about the setting of the RNG.

Usage

setRNG(kind=NULL, seed=NULL, normal.kind=NULL)

Arguments

kind
a character string.
seed
a vector of numbers (depending on kind).
normal.kind
a character string.

Value

  • The old setting.

sideffects

Sets global variables controlling the uniform and normal random number generators and the global seed.

Details

Sets the uniform and normal random number generators and the seed. The old setting is returned in a format which can be used in another call to setRNG. (This would reset to the original value.) If no arguments are given the current setting is returned. In R see RNGkind for more details.

See Also

RNGkind, set.seed, runif, rnorm, random.number.test

Examples

Run this code
setRNG(kind="Wichmann-Hill", seed=c(979,1479,1542), normal.kind="Box-Muller")
rnorm(10)

Run the code above in your browser using DataLab