Hello, happy new year.
I've come back to a problem from last spring. I need to understand
what what is the technically correct method to save a seed and then
re-set it. Although this example arises in the context of MT19937,
I'm needing to do this with other generators as well, including
Hi Paul,
Did you try looking at s1, or ?.Random.seed
s1 - 444
set.seed(s1)
will give you the same result as
set.seed(444)
but .Random.seed does not contain the seed (444), but the state of
the RNG, and is an integer vector.
You can save that state using
s1 - .Random.seed
and restore it
In S+ you can do
orig - .Random.seed
x - runif(10)
set.seed(orig)
identical(x, runif(10)) # return TRUE
because S+'s set.seed interprets a non-scalar
input as a copy of an old .Random.seed and assigns
it in the proper location. (It throws an error
if it is not a valid value for
3 matches
Mail list logo