

   RRaannddoomm NNuummbbeerr GGeenneerraattiioonn

        .Random.seed <- c(n1, n2, n3)

   DDeessccrriippttiioonn::

        `.Random.seed' is an integer vector of length 3, con-
        taining the ``seed'' for all random number generation
        in R.  The Wichmann-Hill generator is used which has a
        cycle length of 6.9536e12 (= `prod(p-1)/4' where `p' is
        the length 3 vector of primes, below), see p.123 of
        Applied Statistics (1984) vol.33 which corrects the
        original article.

   VVaalluuee::

        `.Random.seed == r[1:3]', where  `r[i]' is in `1:p[i]',
        and `p = (30269, 30307, 30323)'.

   NNoottee::

        Initially, there is no seed;  a new one is created,
        using ``Randomize''.  Hence, student exercises will
        each have different simulation results, by default.

   RReeffeerreenncceess::

        B.A. Wichmann and I. D. Hill (1982).  Algorithm AS 183:
        An Efficient and Portable Pseudo-random Number Genera-
        tor, Applied Statistics, 31, 188-190; Remarks: 34,p.198
        and 35, p.89.

        A. De Matteis and S. Pagnutti (1993).  Long-range Cor-
        relation Analysis of the Wichmann-Hill Random Number
        Generator, Statist. Comput., 3, 67-70.

   SSeeee AAllssoo::

        `runif', `rnorm', ....

   EExxaammpplleess::

        runif(1); .Random.seed; runif(1); .Random.seed
        ## If there is no seed,  a ``random'' new one is created:
        rm(.Random.seed); runif(1); .Random.seed

        p.WH <- c(30269, 30307, 30323)
        a.WH <- c(  171,   172,   170)
        R.seed <- function(i.seed = .Random.seed) (a.WH * i.seed) %% p.WH
        my.runif1 <- function(i.seed = .Random.seed)
          { ns <- R.seed(i.seed); sum(ns / p.WH) %% 1 }

        ## This shows how `runif(.)' works, just using  R functions :
        rs <- .Random.seed
        R.seed(rs); u <- runif(1); .Random.seed; c(u, my.runif1(rs))

