From ross at biostat.ucsf.edu  Thu Jul 30 18:51:45 2009
From: ross at biostat.ucsf.edu (Ross Boylan)
Date: Thu, 30 Jul 2009 09:51:45 -0700
Subject: [Rd] user supplied random number generators
In-Reply-To: <85EC2769-AFC0-4C15-ADCB-02F4EB87FD73@gmail.com>
References: <1248934873.18270.83.camel@corn.betterworld.us>
	<85EC2769-AFC0-4C15-ADCB-02F4EB87FD73@gmail.com>
Message-ID: <1248972705.18270.88.camel@corn.betterworld.us>

On Thu, 2009-07-30 at 12:32 +0200, Christophe Dutang wrote:
> > This suggests that the type of user_unif_seedloc is Int32*, not int
> *.
> > It also suggests that user_unif_nseed should return the number of
> 32  
> > bit
> > integers.  The code for PutRNGstate(), for example, uses them in
> just
> > that way.
> >
> > While the dominant model, even on 64 bit hardware, is probably to  
> > leave
> > int as 32 bit, it doesn't seem wise to assume that is always the
> case.
> 
> You can test the size of an int with a configure script. see for  
> example the package foreign, the package randtoolbox (can be found
> in  
> Rmetrics R forge project) I maintain with Petr Savicky.
http://cran.r-project.org/doc/manuals/R-admin.html#Choosing-between-32_002d-and-64_002dbit-builds says "All current versions of R use 32-bit integers".

Also, sizeof(int) works at runtime.  But my question was really about
whether code for user defined RNGs should be written using Int32 or int
as the target type for the state vector.  The R core code suggests to me
one should use Int32, but the documentation says int.

Ross



[Rd] user supplied random number generators
Ross Boylan