Isolate randomness of a local environment from the global R process
问题 We can use set.seed() to set a random seed in R, and this has a global effect. Here is a minimal example to illustrate my goal: set.seed(0) runif(1) # [1] 0.8966972 set.seed(0) f <- function() { # I do not want this random number to be affected by the global seed runif(1) } f() # [1] 0.8966972 Basically I want to be able to avoid the effect of the global random seed (i.e., .Random.seed ) in a local environment, such as an R function, so that I can achieve some sort of randomness over which