From c@g|||e@p|e @end|ng |rom gm@||@com  Fri Jun  7 16:08:46 2019
From: c@g|||e@p|e @end|ng |rom gm@||@com (Colin Gillespie)
Date: Fri, 7 Jun 2019 15:08:46 +0100
Subject: [Rd] Parallel number stream: clusterSetRNGStream
Message-ID: <CADbDLZnxq7Rh8shVS7q3kCCuaogLkYZ3ob2jO3WA1pCrOL+XTg@mail.gmail.com>

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



[Rd] Parallel number stream: clusterSetRNGStream
Colin Gillespie