Skip to content

R-devel Digest, Vol 15, Issue 26

1 message · Josef Leydold

#
Hi,

I am writing a package that provides an interface to other uniform
random number generators. It uses RNGkind(kind="user-supplied") and a
function double *user_unif_rand() as described in the help page
"Random.user". When looking into CRAN I found three other packages
that provide such a function in the DLL that they contribute:
rlecuyer, rsprng, and SuppDists (where it is currently disabled). 
When loading two of thes then the functionality of at least one these
packages is affected. Moreover, a user cannot add his own random
number generator. Probably this is not a problem at all and will not
become a problem. Nevertheless, ...

Is it possible and desired to add the optinional argument PACKAGE to
RNGkind similarly to the .Call() function i.e. to have

RNGkind(kind="user-supplied", PACKAGE="mypackage") ?


When looking at the sources I think it should be straight forward
by extending

typedef struct {
    RNGtype kind;
    N01type Nkind;
    char *name; /* print name */
    int n_seed; /* length of seed vector */
    Int32 *i_seed;
    char *package;   /* <-- added */
} RNGTAB;

and changing the corresponding calls in src/main/RNG.c.

If the anser is yes, maybe I could try to provide a patch for RNG.c.
The only thing I do not fully understand are the entries in 
./src/main/names.c (but I have not studied the syntax of this file in
detail). 

Josef