From ripley@stats.ox.ac.uk  Wed Nov  4 22:10:16 1998
From: ripley@stats.ox.ac.uk (Prof Brian Ripley)
Date: Wed, 4 Nov 1998 22:10:16 +0000 (GMT)
Subject: RNG
In-Reply-To: <98Nov4.163830est.13461@mailgate.bank-banque-canada.ca>
Message-ID: <Pine.GSO.3.96.981104215730.7508B-100000@toucan.stats>

On Wed, 4 Nov 1998, Paul Gilbert wrote:

> On r-help Bill Simpson wrote:
> 
[Comment about the existing generator: yes it has been tested both
theoretically and empirically, and yes it seem to be fine: it just has no
claims to be good of its type, or `efficient' (see the paper title).]


> >Marsaglia's multiply-with-carry generator is very easy to implement--he
> >has posted some C code to newsgroups--and seems to test out OK. I wonder
> >if it would make sense to use one of his generators instead.

Yes, but most generators seem to test out OK, but quite a few of those
that do have been proven to be disasters. Given George Marsaglia's
eminence, these are probably fine, but there are no theoretical results to
my knowledge, and I prefer to use generators that are known to have good
properties in modest numbers of dimensions.
 
> I would like a system where the random number generator can be specified
> (perhaps in options or a .RandomGenerator variable). Most often everyone wants
> to use the best RNG available, but in order to reproduce results and check code
> it is important to use the one which was used to produce the original results.

Well, for most people using an interpreted language like R, most PRNGs are
quite good enough. Compiled code on massively parallel supercomputers is
another game altogether.  Paul's argument is a very good one not to change
what is there (and my reason for not supplying better ones to Allan Wilks
for S in the early 1990s or to R-core). But beware: it is not just the
PRNG but all the variate generators that needs to be unchanged, and large
simulations may well depend on rounding errors and so not be reproducible
except on the same version of R compiled on the same compiler. 

I think a decent API for random-number generators is quite hard to
do: what is the structure for the seeds, for example?


-- 
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._


RNG
Prof Brian Ripley