From 701974d63e33129dad3b4bd0cadf89673505b659 Mon Sep 17 00:00:00 2001 From: DavisVaughan Date: Wed, 21 Oct 2020 12:20:04 -0400 Subject: [PATCH 1/2] Explicitly set seed when using random numbers on the workers --- R/future-invoke-map.R | 2 +- R/future-map.R | 2 +- man/future_invoke_map.Rd | 2 +- man/future_map.Rd | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/R/future-invoke-map.R b/R/future-invoke-map.R index 3274b98..b52890b 100644 --- a/R/future-invoke-map.R +++ b/R/future-invoke-map.R @@ -28,7 +28,7 @@ #' ) #' ) #' -#' future_invoke_map(df$f, df$params) +#' future_invoke_map(df$f, df$params, .options = furrr_options(seed = 123)) #' #' \dontshow{ #' # Close open connections for R CMD Check diff --git a/R/future-map.R b/R/future-map.R index 0353a27..7d600bb 100644 --- a/R/future-map.R +++ b/R/future-map.R @@ -43,7 +43,7 @@ #' \donttest{plan(multisession, workers = 2)} #' #' 1:10 %>% -#' future_map(rnorm, n = 10) %>% +#' future_map(rnorm, n = 10, .options = furrr_options(seed = 123)) %>% #' future_map_dbl(mean) #' #' # If each element of the output is a data frame, use diff --git a/man/future_invoke_map.Rd b/man/future_invoke_map.Rd index ea862ed..a352118 100644 --- a/man/future_invoke_map.Rd +++ b/man/future_invoke_map.Rd @@ -141,7 +141,7 @@ df <- dplyr::tibble( ) ) -future_invoke_map(df$f, df$params) +future_invoke_map(df$f, df$params, .options = furrr_options(seed = 123)) \dontshow{ # Close open connections for R CMD Check diff --git a/man/future_map.Rd b/man/future_map.Rd index be3afae..84a4c73 100644 --- a/man/future_map.Rd +++ b/man/future_map.Rd @@ -165,7 +165,7 @@ library(magrittr) \donttest{plan(multisession, workers = 2)} 1:10 \%>\% - future_map(rnorm, n = 10) \%>\% + future_map(rnorm, n = 10, .options = furrr_options(seed = 123)) \%>\% future_map_dbl(mean) # If each element of the output is a data frame, use From d098ed40adf627fd5b25efc0c4eeed67715c37b9 Mon Sep 17 00:00:00 2001 From: DavisVaughan Date: Wed, 21 Oct 2020 12:21:45 -0400 Subject: [PATCH 2/2] NEWS --- NEWS.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/NEWS.md b/NEWS.md index 6627768..c7ac4ed 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,8 @@ # furrr (development version) +* Updated documentation examples to explicitly set the seed on the workers + when random numbers are generated (#175). + * Removed an internal call to `future:::supportsMulticore()` since it is no longer internal (#174).