home *** CD-ROM | disk | FTP | other *** search
- A Random Number Generator for PC's.
- -----------------------------------
-
- Some time ago, someone posted a version of Marsaglia's Universal Random
- Number Generator. This is one of the best generators, widely used. It is
- described in "Toward a universal random number generator", Statistics and
- Probability Letters, Vol 8, 35-39. Versions have been written in fortran,
- basic, ada, pascal, C and assembler. This generator has the advantage of
- providing exactly the same sequence of random bits in virtually all
- computers, but it suffers from the disadvantage of returning uniform real
- numbers constrained to the range 0/2^24 to (2^24-1)2^24. This is a serious
- disadvantage in some applications: large samples should include uniform
- numbers between 0 and 2^-24 once in a while; the Universal generator cannot.
- Furthermore, the Universal generator returns zero about once in 16 million
- times, too often for some uses, especially when taking logarithms.
-
- A new generator developed by Marsaglia and his colleagues (Zaman and
- Narasimhan) does not suffer from these disadvantages. It passes all the
- stringent tests for randomness in Diehard, their battery of tests. It has
- an incredibly long period, some 2^1407 32-bit random integers, and has fewer
- storage requirements than the Universal generator.
-
- Two assembler routines for this generator have been developed specifically
- for PC's. They are described in "A Random Number Generator for PC's" by G.
- Marsaglia, B. Narasimhan and A. Zaman, Computer Physics Communications (in
- press). The two assembler programs are:
-
- LAUNI.ASM, for use with the Lahey Fortran Compiler (V 2.22 and greater),
- and
- RMUNI.ASM, for use with IBM/2 (Ryan McFarland) Fortran Compiler.
-
- Here is a short description of the entry points to the routines:
-
- Routine Purpose How to use it.
- ------- ------- --------------
- RINIT Initializes table and other CALL RINIT(K)
- values. where K is an 8-digit integer.
- If RINIT is not called, default
- values are used.
-
- UNI Returns a uniform real X = UNI()
- in [0,1).
-
- VNI Returns a uniform real X = VNI()
- in (-1,1).
-
- IVNI Returns a uniform integer J = IVNI()
- between -2^31 and 2^31-1.
-
- IUNI Returns a uniform integer J = IUNI()
- between 0 and 2^31-1.
-
- We invite readers to provide versions for other fortran compilers.
-
- -----------------------------------------------------------------------
- George Marasaglia geo@stat.fsu.edu
- B. Narasimhan naras@stat.fsu.edu
- Arif Zaman arif@stat.fsu.edu
-
- Supercomputer Computations Research Institute
- and
- Department of Statistics
- Florida State University
- Tallahassee, FL 32306
- -----------------------------------------------------------------------
-