This will set a random seed.

set.randomseed(set.seed = TRUE)



Logical. If TRUE, the default, then the function will call set.seed internally with the new random seed.


This will return the new seed invisibly. However, this is also called for its side effects, which is a new seed set using set.seed


This function uses 6 decimal places of Sys.time(), i.e., microseconds. Due to integer limits, it also truncates at 1000 seconds, so there is a possibility that this will be non-unique after 1000 seconds (at the microsecond level). In tests, this showed no duplicates after 1e7 draws in a loop, as expected.


This function does not appear to be as reliable on R <= 4.1.3