[Rd] ?Random.user slightly out of sync with code (PR#13895)

ross at biostat.ucsf.edu ross at biostat.ucsf.edu
Wed Aug 19 05:05:14 CEST 2009


Full_Name: Ross Boylan
Version: 2.7.1
OS: linux
Submission from: (NULL) (38.99.193.74)


The help says
     Optionally,
     functions 'user_unif_nseed' and 'user_unif_seedloc' can be
     supplied which are called with no arguments and should return
     pointers to the number of seeds and to an integer array of seeds.

However, https://svn.r-project.org/R/trunk/src/main/RNG.c has
	    RNG_Table[kind].i_seed = (Int32 *) User_unif_seedloc();
so the precise type that should be returned is a pointer to Int32, not to
integer.  While on most (all?) current platforms these are the same, why invite
future problems?  Correspondingly, nseed is the number of Int32's, not
integers.

Suggested alternative:

Optionally, supply 'user_unif_seedloc', taking no arguments and returning a
pointer to an Int32 array and 'user_unif_nseed', taking no arguments and
returning the size of that array.

It would also be helpful to clarify who is responsible for controlling the
memory user_unif_seedloc points to, and how long it is expected to last.  Might
R write to this memory location?



More information about the R-devel mailing list