tests/compareToStoredOutput.R

library(rngSetSeed)

x1 <- c(
  0.265848361421376466751, 0.279541865922510623932, 0.010057382984086871147,
  0.812093410408124327660, 0.745495849521830677986, 0.964055428979918360710)

x2 <- c(
  0.169724410399794578552, 0.617043599719181656837, 0.053437072783708572388,
  0.321097922278568148613, 0.603132620453834533691, 0.582783419406041502953)

x3 <- c(
  0.42698835558257997036, 0.38425035518594086170, 0.25061429641209542751,
  0.94645602838136255741, 0.77209695545025169849, 0.89415965671651065350)

setVectorSeed(1:50)
stopifnot(abs(x1 - runif(6)) < 1e-10)

setVectorSeed(c(1:50, 0))
stopifnot(abs(x2 - runif(6)) < 1e-10)

setVectorSeed(c(1:50, 1))
stopifnot(abs(x3 - runif(6)) < 1e-10)

setVectorSeed(1:50)
stopifnot(abs(x1 - runif(6)) < 1e-10)

setVectorSeed(c(1:50, 0))
stopifnot(abs(x2 - runif(6)) < 1e-10)

setVectorSeed(c(1:50, 1))
stopifnot(abs(x3 - runif(6)) < 1e-10)

Try the rngSetSeed package in your browser

Any scripts or data that you put into this service are public.

rngSetSeed documentation built on Sept. 19, 2023, 9:06 a.m.