Skip to content

Why R simulation gives same random results?

6 messages · C W, Nordlund, Dan (DSHS/RDA), Brian Ripley +1 more

#
I may have missed it, but I haven't seen a response to this question yet.  If no one has responded, it is probably because you haven't provided the code you used to run the simulation, or a reproducible example which demonstrates the problem.  You say you didn't use set.seed(), but you didn't show what you did do, so there is insufficient information for anyone to be able to comment what went wrong.

Dan 

Daniel J. Nordlund
Washington State Department of Social and Health Services
Planning, Performance, and Accountability
Research and Data Analysis Division
Olympia, WA 98504-5204
#
On 20/02/2013 23:13, Greg Snow wrote:
That is exceedingly unlikely.  We are not told the platform, but AFAIK 
on all common R platforms and current versions of R:

- the time is measured to at least msec accuracy.
- times which might cancel out pid differences are many hours apart.

A while ago it was possible on some platforms to get the same seed by 
starting two R processes on the same clock tick (within 1/60 or 1/100 s 
of each other).  But now you are talking about generating a pretty 
random unsigned integer with 32 bits to set the seed, so the probability 
of coincidence is very small.
Much more likely.
This falls within the class of parallel simulations.  You would do 
better to set carefully selected seeds: see the vignette for package 
'parallel'.