[Rd] Parallel number stream: clusterSetRNGStream
Colin Gillespie
c@g|||e@p|e @end|ng |rom gm@||@com
Fri Jun 7 16:08:46 CEST 2019
Dear All,
Is the following expected behaviour?
set.seed(1)
library(parallel)
cl = makeCluster(5)
clusterSetRNGStream(cl, iseed = NULL)
parSapply(cl, 1:5, function(i) sample(1:10, 1))
# 7 4 2 10 10
clusterSetRNGStream(cl, iseed = NULL)
# 7 4 2 10 10
parSapply(cl, 1:5, function(i) sample(1:10, 1))
stopCluster(cl)
The documentation could be read either way, e.g.
* iseed: An integer to be supplied to set.seed, or NULL not to set
reproducible seeds.
>From Details
.... optionally setting the seed of the streams by set.seed(iseed)
(otherwise they are set from the current seed of the master process:
after selecting the L'Ecuyer generator).
As may be guessed, this caught me out, since I was expecting the same
behaviour as set.seed(NULL).
Thanks
Colin
----------
R version 3.6.0 (2019-04-26)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 18.04.2 LTS
More information about the R-devel
mailing list