RANDM
WTSupported in traditional Synergy on Windows
|
|
USupported on UNIX
|
VSupported on OpenVMS
|
xcall RANDM(number, seed_1, seed_2)
Arguments
number
Returned with the next random number in the sequence. (n)
seed_1
seed_2
Variables that together determine the next random number to be generated. (n)
Discussion
The RANDM subroutine generates a random number from 0 to 32767.
RANDM generates a random number based on two seed values. Seed_1 and seed_2 must be at least five digits long.
After the number is generated, the RANDM subroutine automatically updates the values in seed_1 and seed_2, so you can call RANDM several times successively to generate a sequence of random numbers.
You can start a new sequence by changing the values in seed_1 and seed_2. Each seed value must be between 0 and 32767.
The following example generates a random number in the format ZZ,ZZX, based on two numbers entered by the user.
.define TTCHN ,1 record random ,d5 seed1 ,d5 seed2 ,d5 io ,a10 count ,d4 i ,d4 proc open(TTCHN, i, "tt:") display(TTCHN, "Enter value for seed 1: ") reads(TTCHN, io) seed1 = io display(TTCHN, "Enter value for seed 2: ") reads(TTCHN, io) seed2 = io display(TTCHN, "How many numbers? ") reads(TTCHN, io) count = io for i from 1 thru count begin xcall randm(random, seed1, seed2) io = random, "ZZ,ZZX" writes(TTCHN, io) end stop end