From: bwb@odin.mda.uth.tmc.edu (Barry W. Brown)
Newsgroups: comp.lang.fortran
Subject: Random Number Library Available (REPOST)
Date: 16 Sep 1992 01:40:34 GMT
Organization: University of Texas M.D. Anderson Cancer Center
Originator: bwb@odin


                      Fortran version of RANLIB


RANLIB is a collection of  Fortran routines that provide generators of
random numbers from a variety of distributions.  RANLIB uses published
algorithms, where available  (literature citations are included in the
documentation).

RANLIB  is  available  via  anonymous   FTP from  odin.mda.uth.tmc.edu
(129.106.3.17).  It is
                        /pub/unix/ranlib.f.tar.Z

RANLIB   is  also   available   by   electronic   mail (or  ftp)  from
statlib@lib.stat.cmu.edu.   The  file 'ranlib'  contains   an expanded
description of the package; the file, 'ranlib.shar' contains  the full
code and documentation.  To obtain both,  send mail with the following
two lines to statlib@lib.stat.cmu.edu.
         send ranlib from general
         send ranlib.shar from general
Those who are unfamiliar with statlib might want to add a third line
to obtain an introductory document.
         send index

                    Summary of Ranlib Capabilities

The bottom level routines provide 32 virtual random number generators.
Each generator can provide 1,048,576 blocks of numbers, and each block
is of length 1,073,741,824.  Any generator can be set to the beginning
or end  of the current  block or to  its starting value.  Packaging is
provided   so  that  if  these capabilities  are not  needed, a single
generator with period 2.3 X 10^18 is seen.

Using this base, routines are provided that return:
    (1)  Beta random deviates
    (2)  Chi-square random deviates
    (3)  Exponential random deviates
    (4)  F random deviates
    (5)  Gamma random deviates
    (6)  Multivariate normal random deviates (mean and covariance
         matrix specified)
    (7)  Noncentral chi-square random deviates
    (8)  Noncentral F random deviates
    (9)  Univariate normal random deviates
    (10) Random permutations of an integer array
    (11) Real uniform random deviates between specified limits
    (12) Binomial random deviates
    (13) Poisson random deviates
    (14) Integer uniform deviates between specified limits
    (15) Seeds for the random number generator calculated from a
         character string


                         C version of RANLIB

RANLIB is a Fortran library containing  random number generators for a
number of statistical  distributions.  RANLIB.C   is a translation  of
RANLIB into the C language.

Numerous individuals suggested that I use the f2c  converter from Bell
Labs  to convert RANLIB to C.   In my opinion,  the  quality of the  C
generated by   f2c is greatly   inferior  to  that generated  by   the
commercial product, PROMULA.FORTRAN,  which was used.   Information on
PROMULA.FORTRAN can be obtained from

                   PROMULA Development Corporation
                    3620 N. High Street, Suite 301
                         Columbus, Ohio 43214
                            (614) 263-5454

RANLIB.C  was tested  using the xlc  compiler under AIX  3.1 on an IBM
RS/6000.  The code  was  also examined  with lint  on the same system.
The RANLIB test  programs were also  successfully run using   the  gcc
compiler (see below) on a Solbourne.

RANLIB.C  can be  obtained by  anonymous  ftp to  odin.mda.uth.tmc.edu
(129.106.3.17) where is is available as
                        /pub/unix/ranlib.c.tar.Z

For  obvious   reasons, the   original   RANLIB  (in    Fortran)   has
been renamed to
                        /pub/unix/ranlib.f.tar.Z
on the same machine.

I plan to submit RANLIB.C to statlib after users have given me any
comments and I feel that it is fairly solid.

                                 CAVEAT

RANLIB.C is written in ANSI C and makes  heavy use of prototypes.   It
will not compile under old style (KR) C compilers (such as the default
Sun cc compiler). The decision to  distribute in ANSI C was  mine; the
version of Promula that was used -- 2.0 --  writes  old style headers.
Converting  RANLIB to old style  C is not  a totally trivial task; the
type of many arguments to functions will have to be changed from float
to double.  Also note that I don't changed all ints to longs.  This is
a result of my being a Fortraner, a novice at C, and knowing  that the
underlying generators require at least a 32 bit integer.

I don't recommend  conversion to  an obsolete C dialect.  Instead, get
the Free  Software Foundation's excellent  ANSI  C  compiler,  gcc. It
compiles KR C as well as  ANSI version that  runs on many varieties
of Unix is available by anonymous ftp as
                        /pub/gnu/gcc-1.40.tar.Z
at prep.ai.mit.edu  (18.71.0.38).   A Vax version  is also  present on
/pub/gnu.  The compilers  are also available  on tape.  Write the Free
Software Foundation at:

                    Free Software Foundation, Inc.
                       675 Massachusetts Avenue
                         Cambridge, MA  02139
                        Phone: (617) 876-3296

An MSDOS port of gcc, performed by DJ Delorie is also available by ftp.

File location:

    host:      grape.ecs.clarkson.edu
    login:     ftp
    password:  send your e-mail address
    directory: ~ftp/pub/msdos/djgcc

File in .ZIP format - djgpp.zip - one 2.2M file, contains everything.



                                       Barry W. Brown
                                       Department of Biomathematics, 
                                            Box 237
                                       University of Texas M. D.
                                            Anderson Hospital
                                       1515 Holcombe Blvd
                                       Houston, TX 77030

bwb@odin.mda.uth.tmc.edu
internet address is (129.106.3.17)
-- 
                                       Barry W. Brown
                                       Department of Biomathematics, 
                                            Box 237
                                       University of Texas M. D.
Newsgroups: comp.lang.fortran