tests/random.R

library(aakmisc)

if (.Platform$OS.type == "unix") {
  seed <- urandom(n=1)
} else {
  seed <- 7968868L
}

if (Sys.getenv("FULL_TESTS")=="yes") {
  x <- random.org(5)
  stopifnot(is.integer(x) && length(x)==5)
}

set.seed(seed)
rngSeeds(5,seed=seed)

x1 <- runif(5)
y1 <- rngControl(runif(5),seed=34934L)
y2 <- rngControl(runif(5),seed=34934L)
z1 <- runif(5)

set.seed(seed)
x2 <- runif(5)
z2 <- runif(5)

stopifnot(identical(x1,x2))
stopifnot(identical(y1,y2))
stopifnot(identical(z1,z2))
kingaa/aakmisc documentation built on April 3, 2024, 1:33 a.m.