[R-sig-hpc] rstream.RNG does not reset the RNG to its initial state
Renaud Gaujoux
renaud at mancala.cbio.uct.ac.za
Tue Feb 8 14:35:39 CET 2011
Hi,
playing around with the package rstream, I came across the following issue.
Am I doing something wrong?
Thank you.
Regards,
Renaud
###################
library(rstream)
set.seed(1)
# using the rstream interface for the built-in RNG: everything is fine
old <- rstream.RNG()
runif(4)
rstream.RNG(old)
runif(4)
# using the rstream interface for mrg32k3a
m <- new('rstream.mrg32k3a')
rstream.RNG(m)
runif(4)
# if I reset the RNG to its previous state, the generated values are shifted
rstream.RNG(m)
runif(4)
# if I reset the RNG to the built-in generator and then back again to
mrg32k3a, then it works fine
rstream.RNG(old)
runif(4)
rstream.RNG(m)
runif(4)
# But again...
rstream.RNG(m)
runif(4)
R version 2.12.1 (2010-12-16)
Platform: x86_64-pc-linux-gnu (64-bit)
locale:
[1] LC_CTYPE=en_ZA.utf8 LC_NUMERIC=C
LC_TIME=en_ZA.utf8 LC_COLLATE=en_ZA.utf8
LC_MONETARY=C LC_MESSAGES=en_ZA.utf8 LC_PAPER=en_ZA.utf8
[8] LC_NAME=C LC_ADDRESS=C
LC_TELEPHONE=C LC_MEASUREMENT=en_ZA.utf8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] rstream_1.2.5
###
UNIVERSITY OF CAPE TOWN
This e-mail is subject to the UCT ICT policies and e-mai...{{dropped:5}}
More information about the R-sig-hpc
mailing list