Path: utzoo!mnetor!tmsoft!torsqnt!jarvis.csri.toronto.edu!rutgers!ucsd!usc!cs.utexas.edu!uunet!mcsun!ukc!dcl-cs!gdt!gdr!exspes From: exspes@gdr.bath.ac.uk (P E Smee) Newsgroups: comp.lang.rexx Subject: Re: Arexx 'random' number generation Message-ID: <1989Nov16.102415.7663@gdt.bath.ac.uk> Date: 16 Nov 89 10:24:15 GMT References: <[255dd53e:14]comp.lang.rexx@tronsbox.UUCP> <89318.193843CMH117@PSUVM.BITNET> Reply-To: exspes@gdr.bath.ac.uk (P E Smee) Organization: University of Bristol c/o University of Bath Lines: 27 In article <89318.193843CMH117@PSUVM.BITNET> CMH117@PSUVM.BITNET (Charles Hannum) writes: >You are a bonehead. The first time you call the random number generator, >(RANDOM), you need to give it a "seed" value as the third argument, otherwise >you will continue to get the same numbers every time ... Really? If so, then Arexx has got it backwards. In 'proper' REXX (to quote from the manual) [If you specify a seed in the first call] the numbers are generated mathematically, using the initial seed, so that as far as possible they appear to be random. Running the program again will produce *the same sequence*; using a *different* initial seed will produce a *different* sequence. If you *do not* specify a seed, the first time RANDOM is called, the microsecond field of the time-of-day clock will be used as the seed; and hence your program will give different results each time it is run. (*'s are mine for emphasis). If you think about it, it has to be this way, as otherwise you need a 'metaRandom' function of some sort to provide an initial seed for your RANDOM function if you want non-repeating behaviour. -- Paul Smee | JANET: Smee@uk.ac.bristol Computer Centre | BITNET: Smee%uk.ac.bristol@ukacrl.bitnet University of Bristol | Internet: Smee%uk.ac.bristol@nsfnet-relay.ac.uk (Phone: +44 272 303132) | UUCP: ...!uunet!ukc!gdr.bath.ac.uk!exspes