[randnum0]    Random Number Generators
    Version 2.10, April 2005
      
   Andrew Thomas
1
      

   
1 Dept of Mathematics & Statistics,
      University of Helsinki
      Helsinki
      Finland


   e-mail: ant@rni.helsinki.fi   


The module MathRandnum defines an abstract class Generator for generating pseudo random numbers with a uniform distribution on [0,1]. Two implementations of the Generator class are given in modules MathLincon (a linear congurance algorithm) and MathTT800 (a twisted GFSR algorithm). The module MathRandnum implements several non uniform random number genertors using an object of class Generator to generate random uniforms. The state of these non uniform random number generators only depends on the state of the Generator object used. MathRandom contains procedures for manipulated the current Generator object.

The procedure MathLincon.Install and MathTT800.Install set the Generator object in MathRandnum to use a linear congurance and a twisted GFSR algorithm respectively. These two procedures set the Generator object to a fixed default state. The INIT function in file Bugs/Rsrc/Script.txt sets the random number generator used by OpenBUGS (currently a linear congurance generator is installed). OpenBUGS uses one Generator object for all the chains it simulates. This could be altered so that each chain uses a seperate Generator object.

A small test model -- model{ u ~ dunif(0, 1) } -- was updated for 10000000 iterations to give a quick check of the MathLincon and MathTT800 algorithms, with the following results:

mean   sd   2.5%   5%   10%   25%   50%   75%   90%   95%   97.5%
0.5001   0.2887   0.02501   0.05004   0.1   0.25   0.5001   0.7501   0.9   0.9499   0.975   
0.4999   0.2887   0.02491   0.04994   0.09993   0.2499   0.4998   0.7499   0.9   0.9499   0.975

Both random number gerators appear to work well but we have has little experience with the MathTT800 algorithm and have had some difficulty coding the algorithm.