R-alpha: random seed

Ross Ihaka (ihaka@stat.auckland.ac.nz)
Fri, 26 Jul 1996 13:39:49 +1200


Date: Fri, 26 Jul 1996 13:39:49 +1200
From: Ross Ihaka <ihaka@stat.auckland.ac.nz>
Message-Id: <199607260139.NAA09795@stat.auckland.ac.nz>
To: R-testers@stat.math.ethz.ch
Subject: R-alpha: random seed
In-Reply-To: <96Jul25.144639edt.29472@mailgate.bank-banque-canada.ca>

There is an invisible variable called .Random.seed which contains the
current seeds.  You can do things like

	print(.Random.seed)
	old.seeds <- .Random.seed
	rnorm(1000)
	.Random.seed <- old.seed
	norm(1000) # same sequence

If there is no variable called .Random.seed one is created by fiddling
with the system clock and the generator in the standard C library.
We did this to try to ensure that students all got different sequences
to make it eassy to stomp on cheats.

The underlying generator is the Wichman-Hill one from Applied
Statistics.  It uses 3 integer seeds, so that .Random.seed should
be a numeric vector containing 3 integer values.
	Ross
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
r-testers mailing list -- To (un)subscribe, send
subscribe	or	unsubscribe
(in the "body", not the subject !)  To: r-testers-request@stat.math.ethz.ch
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-