search for: getrandomseed

Displaying 3 results from an estimated 3 matches for "getrandomseed".

Did you mean: setrandomseed
2019 Oct 30
2
set.seed() in a package
...({ if (is.null(oseed)) { rm(list=".Random.seed", envir= .GlobalEnv) } else { assign(".Random.seed", value=oseed, envir= .GlobalEnv) } }) to avoid that warning. So, having support functions for this in base R would be helpful, e.g. oseed <- base::getRandomSeed() on.exit(base::setRandomSeed(oseed)) Back to Marvin's point/question. I think it would be useful if the CRAN Policies would explicitly say that functions must not change the random seed to a fixed one, without undoing it, unless the user specifies it via an argument. If not, there's a...
2019 Oct 30
0
set.seed() in a package
Forgot to say: For, oseed <- base::getRandomSeed() on.exit(base::setRandomSeed(oseed)) one could upgrade set.seed() to take this role, e.g. oseed <- set.seed(0xBEEF) on.exit(set.seed(oseed)) Current, set.seed() always return NULL. BTW, and my memory might be bad, I think I mentioned this in the past but was told that you cannot reset...
2019 Oct 30
2
set.seed() in a package
We commit a similar sin in the help pages, e.g. example(set.seed) ; runif(2) example(set.seed) ; runif(2) gives you the same random uniforms both times. (Of course it isn't that much of an issue, since you would rarely be running examples before any serious simulations.) You can fairly easily work around that by saving and restoring .Random.seed. I wonder if that isn't also true of the