tests/testthat/test_util.R

test_that('restoring the random seed works', {
  if (!exists('.Random.seed')) RNGkind()
  seed <- .Random.seed
  first <- with_seed(0, rnorm(10))
  second <- with_seed(0, rnorm(10))
  expect_equal(.Random.seed, seed)
  expect_equal(first, second)
})

Try the knockoff package in your browser

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

knockoff documentation built on July 2, 2020, 12:02 a.m.