# [Rd] Seed in 'parallel' vignette

Marius Hofert marius.hofert at uwaterloo.ca
Tue Feb 3 16:39:43 CET 2015

```Hi,

This is most likely only a minor technicality, but I saw the
following: On page 6 of the 'parallel' vignette
(http://stat.ethz.ch/R-manual/R-devel/library/parallel/doc/parallel.pdf),
the random-number generator "L'Ecuyer-CMRG" is said to have seed
"(x_n, x_{n-1}, x_{n-2}, y_n, y_{n-1}, y_{n-2})". However, in L'Ecuyer
et al. (2002), the seed is given with 'increasing' indices, so should
rather be "(x_{n-2}, x_{n-1}, x_n, y_{n-2}, y_{n-1}, y_n)" (or, even
more intuitively, "(x_{n-3}, x_{n-2}, x_{n-1}, y_{n-3}, y_{n-2},
y_{n-1})"). The question is how it's done in R (?): If as given in the
vignette, one should maybe point this out as other (languages)
following L'Ecuyer et al. (2002) might obtain different random numbers
then. And if it's implemented as in L'Ecuyer, then one probably wants
to adjust the vignette to reflect this.

Other minor suggestions to improve the vignette (if that's what's also
done in R; I couldn't easily figure that out from ./src/main/RNG.c):
1) when defining u_n, I would write u_n = z_n / (2^32-208) [as it is
immediately clear then that one divides by the modulus of the first
linear congruential generator + 1]
2) The case z_n=0 is not provided (for a reason?). If z_n=0, L'Ecuyer
suggests to set u_n to "(2^32-209)/(2^32-208)".

Cheers,
Marius

--
Marius Hofert, Dr. rer. nat.
Assistant Professor
Department of Statistics and Actuarial Science
Faculty of Mathematics
University of Waterloo
200 University Avenue West, Waterloo, ON, N2L 3G1
+1-519-888-4567, ext. 31394 (office M3 4207)
http://math.uwaterloo.ca/~mhofert

```