RNG initialization
Prof Brian D Ripley
ripley@stats.ox.ac.uk
Tue, 18 Jan 2000 08:08:55 +0000 (GMT)
On Mon, 17 Jan 2000, Ben Bolker wrote:
> It would be nice to be able to initialize the random-number generator
> with a single long argument; I can see that in principle this could be
> done by writing an access method, do_RNGinit (or whatever) for RNG_Init.
> I had trouble with the technical details, possibly because of long/int
> incompatibilities.
What precisely do you want to do? Is that `long' as in C code? There is no
means to pass a `long' from R code to C, but RNG_Init in fact only
makes use of 32 bits so should have `int' there. (It's a poor
choice of algorithm though, as it uses a multiplicative generator
without ensuring the starting point is odd.)
My best guess is that you would like a function like S's set.seed,
which when called with a single number sets the whole initial seed.
This is certainly easy to do, and can be done easily in R code.
Since set.seed seems a suitable name and it would help compatibility,
would
set.seed(seed, kind = 0)
be a suitable interface? Or would people prefer
RNGinit(kind, seed)
?
--
Brian D. Ripley, ripley@stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272860 (secr)
Oxford OX1 3TG, UK Fax: +44 1865 272595
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._