Annotation of 43BSDTahoe/new/help/src/f77/random, revision 1.1

1.1     ! root        1: .TI F77/RANDOM "Sep. 4, 1985"
        !             2: Random Number Generators
        !             3: 
        !             4: You can generate sequences of random numbers using random()
        !             5: from the f77 system library, or by using procedures in the IMSL or
        !             6: NAG libraries.
        !             7: This help file includes examples using random(),
        !             8: ggubs() from the IMSL library and g05caf() from the NAG library.
        !             9: ggubs() and g05caf() are recommended over random().
        !            10: See "help f77 nag" and "help f77 imsl" for information on whether IMSL
        !            11: and NAG are available on this system.
        !            12: 
        !            13: The functions random(), irandm(), and drandm() in the f77 library
        !            14: provide sequence of real, integer and double precision random numbers.
        !            15: To get a sequence of 100 pseudo-random numbers between 0 and 1.0:
        !            16: 
        !            17: .nf
        !            18:                real x(100)
        !            19:                   ...
        !            20:                x(1) = random(1)
        !            21:                do 10 i=2,100
        !            22:        10      x(i) = random(0)
        !            23: .fi
        !            24: 
        !            25: The first call with argument of 1 starts the sequence with the same
        !            26: number each time the program is run.  This is useful for debugging when
        !            27: you need to compare two runs.  The later calls with argument of 0
        !            28: cause the next random number in the sequence to be returned.  If you
        !            29: want to generate a different sequence each time the program is run,
        !            30: use:
        !            31: 
        !            32: .nf
        !            33:                integer time
        !            34:                real x(100)
        !            35:                   ...
        !            36:                x(1) = random(time())
        !            37:                do 10 i=2,100
        !            38:        10      x(i) = random(0)
        !            39: .fi
        !            40: 
        !            41: For details, see "man 3f random".
        !            42: 
        !            43: NAG section G05 and IMSL chapter G contain over 80 subroutines dealing
        !            44: with generating and testing pseudo-random numbers.  To generate a
        !            45: sequence of 100 single precision pseudo-random numbers in the interval (0.,1.)
        !            46: using IMSL's ggubs:
        !            47: 
        !            48: .nf
        !            49:              real randsp(100), ggubfs
        !            50:              double precision dseed
        !            51: 
        !            52:              dseed = 123457.d0
        !            53:              do 20 i = 1, 100
        !            54:        20    randsp(i) =  ggubfs( dseed )
        !            55: .fi
        !            56: 
        !            57: \&'dseed' is changed by ggubfs(), so it must be a variable and your program
        !            58: must not change it between calls to ggubfs().  The sequence generated depends
        !            59: on the initial value of 'dseed'; it must be between 1.0d0 and 2147483647.0d0 .
        !            60: To access the IMSL library, add '-limsld' at the end of your f77 command.
        !            61: 
        !            62: To generate a sequence of 100 double pseudo-random precision numbers
        !            63: in the interval (0.,1.) using NAG's g05caf():
        !            64: 
        !            65: .nf
        !            66:              double precision randdp(100), g05caf
        !            67: 
        !            68:              do 30 i = 1,100
        !            69:        30    randdp(i) = g05caf(dummy)
        !            70: .fi
        !            71: 
        !            72: g05caf() uses common blocks /ag05ca/ and /bg05ca/, so your program
        !            73: should not changes values in these common blocks.  This generates the
        !            74: same sequence each time it is used; to generate a different sequence
        !            75: each time your program is run, begin your program with:
        !            76: 
        !            77:              call g05ccf
        !            78: 
        !            79: g05ccf should be called before the first call on g05caf() and should be
        !            80: called only once.  It will initialize the random sequence using the
        !            81: current time to generate a seed.  To access the NAG library,
        !            82: add '-lnagd' at the end of your f77 command.

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.