Skip to content

rnorm

1 message · Brian Ripley

#
Well, I hadn't looked until recently. I find all of that section of code
somewhat less than transparent (and spread across directories, let alone
files).

rnorm.c says

N01type N01_kind = KINDERMAN_RAMAGE;

so that is what you get by default. You can change it from C code as that
is an exported variable.  But the intended mechanism appears to be that it is
part of the choice of RNG in RNGkind, except that is it unused. See 
(nmath/sunif.c)

RNGTAB RNG_Table[] =
{
/* kind Nkind     name    is_seeded seed-length i1_s, *seed-vec */
    { 0, 0, "Wichmann-Hill",    0,      3,      123,    dummy},
    { 1, 0, "Marsaglia-MultiCarry",0,   2,      123,    dummy},
    { 2, 0, "Super-Duper",      0,      2,      123,    dummy},
    { 3, 0, "Mersenne-Twister", 0,  1+624,      123,    dummy},
    { 4, 0, "Rand",             0,      2,      -1,     dummy},
};

where Nkind is of N01type. I think Martin Maechler will need to explain
what he intended here, as well as why he did not use the enumeration
constants for Nkind in this table.  And

head src/include/Random.h 
/* only used by ../main/random.c  & ../nmath/sunif.c
 */

appears to be wrong: it is used in ../nmath/snorm.c too.

Martin: as a general policy I would prefer header files used in a few
places to be explicit, not hidden through Mathlib.h.  The way it is
currently done hides dependencies, as in the missing dependence of snorm.o on
$(top_srcdir)/src/include/Random.h.

[I have committed the dependencies in brief spell while Auckland was 
contactable.]

Brian