[R] Same initial seed
diegol
diegol81 at gmail.com
Mon Jun 29 00:52:02 CEST 2009
Update:
I had tried, immediately after launching the console:
> rm(list=ls())
which did not seem to affect .Random.seed. But now I try:
> rm(.Random.seed)
which seems to force .Random.seed to regenerate from current time.
Can I feel confident to have solved the problem?
Thanks!
diegol wrote:
>
> Hello,
>
> I have tried a few searches without luck before posting, since this one
> seems a pretty basic question.
> I am using R 2.7.0 on WinXP, as I have long started using this version for
> my thesis work and am reluctant to update fearing consistency/backward
> compatibility issues could happen.
>
> I noticed that whenever I start an R session (launch the console
> application) and run a script involving random number generation, eg:
>
>> rnorm(10)
>
> I get the same result. In fact, each time I start a new R session and
> enter
>
>> .Random.seed
>
> I get the same exact vector. From ?.Random.seed:
>
> "Initially, there is no seed; a new one is created from the current time
> when one is required. Hence, different sessions will give different
> simulation results, by default." (as stated in R 2.7.0's documentation)
>
> When I try RSiteSearch(".Random.seed") I get this updated result:
>
> "Initially, there is no seed; a new one is created from the current time
> when one is required. Hence, different sessions started at (sufficiently)
> different times will give different simulation results, by default.
> However, the seed might be restored from a previous session if a
> previously saved workspace is restored."
>
> My PC clock is working fine. I think the problem is not related to
> allotting "sufficient" time between sessions either, which leads me to
> think this has to do with a previously saved workspace, which in the case
> I mention is indeed restored.
>
> I would like to generate different random numbers in each session. The two
> choices I seem to have are:
> i) Not restore the workspace so a new seed is created from the current
> time (I have to look into how to go about this);
> ii) Leave the workspace alone and manually set a new seed via set.seed()
>
> Am I leaving any options out or getting something wrong?
>
> Thank you.
>
-----
~~~~~~~~~~~~~~~~~~~~~~~~~~
Diego Mazzeo
Actuarial Science Student
Facultad de Ciencias Económicas
Universidad de Buenos Aires
Buenos Aires, Argentina
--
View this message in context: http://www.nabble.com/Same-initial-seed-tp24246135p24246357.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list