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