real function ran183(ix,iy,iz) c c Algorithm AS 183 Appl. Statist. (1982) vol.31, no.2 c c Returns a pseudo-random number rectangularly distributed c between 0 and 1. The cycle length is 6.95E+12 (See page 123 c of Applied Statistics (1984) vol.33), not as claimed in the c original article. c c IX, IY and IZ should be set to integer values between 1 and c 30000 before the first entry. c c Integer arithmetic up to 30323 is required. c integer ix, iy, iz c ix = 171 * mod(ix, 177) - 2 * (ix / 177) iy = 172 * mod(iy, 176) - 35 * (iy / 176) iz = 170 * mod(iz, 178) - 63 * (iz / 178) c if (ix .lt. 0) ix = ix + 30269 if (iy .lt. 0) iy = iy + 30307 if (iz .lt. 0) iz = iz + 30323 c c If integer arithmetic up to 5212632 is available, the preceding c 6 statements may be replaced by: c c ix = mod(171 * ix, 30269) c iy = mod(172 * iy, 30307) c iz = mod(170 * iz, 30323) c ran183 = mod(float(ix) / 30269. + float(iy) / 30307. + + float(iz) / 30323., 1.0) return end