disk8: Initial commit
[pdp8.git] / sw / adventure / RND.FT
1 INTEGER FUNCTION RND(LIMIT)
2
3 C
4 C GENERATES RANDOM INTEGER IN THE RANGE
5 C 0 < N < LIMIT
6 C
7 C USES THE RANDOM SEED GENERATED BY THE
8 C RALF MODULE "SEED"
9 C
10 COMMON/NUMCOM/NUMBER
11 LOGICAL FLAG
12 DATA FLAG/.FALSE./,NUMBER/0/
13 IF(FLAG)GOTO 10
14 FLAG=.TRUE.
15 IRND=132*(NUMBER+327)
16 10 IRND=MOD(IRND*1021,1048576)
17 RND=(LIMIT*IRND)/1048576
18 RETURN
19 END