Skip to content

Commit

Permalink
make it truly random
Browse files Browse the repository at this point in the history
  • Loading branch information
emitanaka committed Oct 14, 2023
1 parent e81698a commit 6b02829
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions R/provenance.R
Original file line number Diff line number Diff line change
Expand Up @@ -696,10 +696,10 @@ Provenance <- R6::R6Class("Provenance",
#' @param type Type.
save_seed = function(seed, type) {
private$record_track_internal()
if (!exists(".Random.seed", envir = .GlobalEnv, inherits = FALSE))
stats::runif(1)
ranexists <- exists(".Random.seed", envir = .GlobalEnv, inherits = FALSE)
if (ranexists) rm(.Random.seed, envir = .GlobalEnv)
stats::runif(1)
if (is.null(seed)) {
set.seed(Sys.time())
RNGstate <- get(".Random.seed", envir = .GlobalEnv)
} else {
set.seed(seed)
Expand Down

0 comments on commit 6b02829

Please sign in to comment.