[R] set.seed( ) function

Petr Savicky savicky at praha1.ff.cuni.cz
Sun Apr 24 12:30:00 CEST 2011

On Sun, Apr 24, 2011 at 10:10:45PM +1200, Penny Bilton wrote:
> Thank you for the help so far.  Also, I don't quite understand what the 
> set.seed function does. Does it choose a starting point for the random 
> number generation?

Yes. The generator produces a periodic sequence, which may be understood
as a long cycle. The seed specifies a starting point in this cycle. For
the default generator in R, the period is 2^19937-1, which is a Mersenne
prime. The period is long enough so that it cannot be exhausted. The 
function set.seed() allows to choose between approximately 2^32 different
starting points.

Petr Savicky.

More information about the R-help mailing list