[fa.info-vax] mth

info-vax@ucbvax.ARPA (11/02/84)

From: callas%meteor.DEC@decwrl.ARPA  (Hardware is just a mathematical abstraction)

Mth$random is documented in the Run-Time Library Reference Manual, which
is volume 6A of a full VMS V3 documentation set. Documentation can also be
found by typing "HELP RTL MTH$ RANDOM" under V3.x or "HELP RTL MTH$ 
MTH$RANDOM" under V4. The calling sequence has not changed from V3 to V4. 
Here is a copy of the help library text from V3.7:

RTL

  MTH$

    RANDOM

       Random Number Generator, Uniformly Distributed

      Format

       result.wf.v = MTH$RANDOM (seed.mlu.r)

      Arguments

       seed
         An unsigned longword containing the integer seed.
       result
         The F_floating random number.

A call to MTH$RANDOM will return a number in the interval [0.0,1.0). My
favorite way to initialize the seed is to call SYS$GETTIM to get the
quadword system time and use the middle longword (16 bits filler, 32 bits
seed number, 16 bits filler) as the seed. If you are calling mth$random
many times, resetting the seed from the clock every so often (say every 100
to 10,000 calls) can make mth$random a truly random variable.