I'm using the future.callr
that creates a new thread(?) every time a future is requested so it is calculated separately and the main R script can keep moving on.
I'm getting the following warning when my futures come back:
Warning message:
UNRELIABLE VALUE: Future (‘<none>’) unexpectedly generated random numbers without specifying argument 'seed'. There is a risk that those random numbers are not statistically sound and the overall results might be invalid. To fix this, specify 'seed=TRUE'. This ensures that proper, parallel-safe random numbers are produced via the L'Ecuyer-CMRG method. To disable this check, use 'seed=NULL', or set option 'future.rng.onMisuse' to "ignore".
In the actual code I'm running, it's just loading some data and I don't know why (or care EDIT: I do care, see comments below) that it's generating random numbers. How do I stop that warning from being shown (either fixing the rng generation or just ignoring it)?
I've got a lot of lines with futures so I am hoping to be able to just set the option at the beginning somehow and not have to add it to every line.
Here's an example and my attempt to ignore the warning.
library(future.callr)
set.seed(1234567)
future.seed = TRUE
#normal random number - no problem
a<-runif(1)
print(a)
#random number in future, using callr plan
plan(callr, future.rng.onMisuse = 'ignore')
b %<-% runif(1)
print(b)
See
help("%seed%", package = "future")
.You could either use
%seed%
like below:Or to disable checking