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. Any chance of this happening? -- Ben Bolker bolker@zoo.ufl.edu Zoology Department, University of Florida http://www.zoo.ufl.edu/bolker 318 Carr Hall/Box 118525 tel: (352) 392-5697 Gainesville, FL 32611-8525 fax: (352) 392-3704 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
> Date: Tue, 18 Jan 2000 10:26:26 -0500 > From: Paul Gilbert <pgilbert@bank-banque-canada.ca> > > >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) > > Before making too many changes to random number generation it might be usefulto> look at the code below which is part of my syskern package. It sets the seed,As I understand it, that does not do what either S-PLUS's set.seed does or what Ben asks for, as the seed has to be of a length and values appropriate to the RNGkind. The request was to use a single value: otherwise why not just assign to .Random.seed? Personally I do not like the altering of system functions in user packages, as what happens if two or more people do it? It depends on the load order. -- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
> Date: Tue, 18 Jan 2000 11:35:45 -0500 > From: Paul Gilbert <pgilbert@bank-banque-canada.ca>> >Personally I do not like the altering of system functions in user > >packages, as what happens if two or more people do it? It depends > >on the load order. > > Yes, I don't see any way around this in Splus, but it would be nice if it was > done in R base. In fact as I recall, some of the hooks may be in R's C codeand> that would be the fastest place to do RNG changes. Martin was going to look at > it sometime, but I don't know if he has had a chance.Sure, it is easy and that was what I was proposing to do. I was just proposing to be compatible with S-PLUS and not syskern. I really don't see why syskern needs to use the name set.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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._