Commit | Line | Data |
---|---|---|
84b5715c PH |
1 | INTEGER FUNCTION RND(LIMIT)\r |
2 | \r | |
3 | C\r | |
4 | C GENERATES RANDOM INTEGER IN THE RANGE\r | |
5 | C 0 < N < LIMIT\r | |
6 | C\r | |
7 | C USES THE RANDOM SEED GENERATED BY THE\r | |
8 | C RALF MODULE "SEED"\r | |
9 | C\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 | |
16 | 10 IRND=MOD(IRND*1021,1048576)\r | |
17 | RND=(LIMIT*IRND)/1048576\r | |
18 | RETURN\r | |
19 | END\r |