An implementation of the recurrence of WELL generators in R language

Description

An implementation of the recurrence of WELL generators in R language for testing purposes. It is too slow to be used for random number generation.

Usage

1
2
 
  rngWELLScriptR(n, s, generator, includeState=FALSE)

Arguments

n

Integer. The length of the output sequence.

s

An 0,1-matrix representing the state of the required WELL generator as obtained by getWELLState().

generator

Character string. Name of the generator from the list "512a", "521a", "521b", "607a", "607b", "800a", "800b", "1024a", "1024b", "19937a", "19937c", "19937b", "21701a", "23209a", "23209b", "44497a", "44497b".

includeState

Logical. Controls, whether the output should contain the final internal state additionally to the numerical output or not.

Value

If includeState=FALSE, a numeric vector of length n containing the numerical output of the generator. If includeState=TRUE, a list with components x (the numerical output) and state (the final internal state of the generator).

See Also

getWELLState

Examples

1
2
3
4
5
6
  set.generator("WELL", order=512, version="a", seed=123456)
  s <- getWELLState()
  x <- runif(500)
  y <- rngWELLScriptR(500, s, "512a")
  all(x == y)
  # [1] TRUE