Skip to content
Prev 4291 / 63421 Next

.Random.seed resetting (PR#656)

lej25> Full_Name: Lara Jamieson Version: 1.1.1 OS: Linux Submission
    lej25> from: (NULL) (131.111.20.203)

    lej25> I've checked for other reports on this and can't find anything.
    lej25> It seems that the .Random.seed isn't updated properly after
    lej25> using rm(.Random.seed).  Mu understanding from the help file
    lej25> indicates that a new 'random' seed will be generated.  It
    lej25> appears that sometimes the old one is just reinstated.

    lej25> I removed my .RData file and the problem remains.  It seems to
    lej25> happen when calls are made in succession to the same 'random
    lej25> generation type' function; but appears to

    lej25> work when different calls are made in succession.  An example is
    lej25> given below.  I was using the sample command when I found the
    lej25> problem but it happens with runif as well...

    >> runif(1)
    lej25> [1] 0.5551602
    >> runif(1)
    lej25> [1] 0.2575637
    >> rm(.Random.seed) runif(1)
    lej25> [1] 0.5551602
    >> rm(.Random.seed) rm(.Random.seed)
    lej25> Warning message: remove: variable ".Random.seed" was not found
    >> runif(1)
    lej25> [1] 0.2575637


[I don't get your behavior]
Could it be that you have a .Random.seed further up in your search() path?
This would explain everything.

Try
    find(.Random.seed, where = TRUE)

which would show you the place where you had another copy if that was the
solution ...