[R] can you tell what .Random.seed *was*?

Stavros Macrakis macrakis at alum.mit.edu
Fri May 15 20:53:44 CEST 2009

On Fri, May 15, 2009 at 12:07 PM, Stavros Macrakis
<macrakis at alum.mit.edu> wrote:
> system.time(whatseed(runif(1)))

Sorry, though I got lucky and my overall result is roughly correct,
this is an incorrect time measure.  It should be

    r <- runif(1); system.time(whatseed(r))

because R's call-by-need semantics don't evaluate the runif before it
starts running whatseed.  The correct time (on my machine) is then 28
hours, not 18.

Better to avoid side-effect functions as arguments....


More information about the R-help mailing list