[Rd] Which function can change RNG state?
Dirk Eddelbuettel
edd at debian.org
Sun Feb 8 15:33:26 CET 2015
On 7 February 2015 at 19:52, otoomet wrote:
| random numbers. For instance, can I be sure that
| set.seed(0); print(runif(1)); print(rnorm(1))
| will always print the same numbers, also in the future version of R? There
Yes, pretty much.
I've been lurking here over fifteen years, and while I am getting old and
forgetful I can remember exactly one such change where behaviour was changed,
and (one of the) generators was altered---if memory serves in the earlier
days of R 1.* days . [ Goes digging...] Yes, see `help(RNGkind)` which
details that R 1.7.0 made a change when "Buggy Kinderman-Ramage" was added as
the old value, and "Kinderman-Ramage" was repaired. There once was a similar
fix in the very early days of the Mersenne-Twister which is why the GNU GSL
has two variants with suffixes _1998 and _1998.
So your issue seems like pilot error to me: don't attach the parallel package
if you do not plan to work in parallel. But "do if you do", and see its fine
vignette on how it provides you reproducibility for multiple RNG streams.
In general, you can very much trust R (and R Core) in these matters.
Dirk
--
http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org
More information about the R-devel
mailing list