Created
December 27, 2019 11:33
-
-
Save mpjdem/16eda9297e452628c285b37d71d2cc82 to your computer and use it in GitHub Desktop.
Example of global RNG state
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pick_name <- function() { | |
names <- c("Dax", "Wug", "Lep", "Sik", "Bop") | |
sample(names)[1] | |
} | |
set.seed(100) | |
print(pick_name()) # Wug | |
print(runif(1)) # 0.4837707 | |
pick_name <- function() { | |
names <- c("Dax", "Wug", "Lep", "Sik", "Bop") | |
sample(names, size = 1) | |
} | |
set.seed(100) | |
print(pick_name()) # Wug | |
print(runif(1)) # 0.2576725 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment