program random integer*4 i,j,ix,iy,iz real*8 frandom common /randc/ ix, iy, iz ix=1 iy=1000 iz=99 do i=1,1000 do j=1,1000 write(60,*)frandom(i),frandom(i) enddo enddo stop end function frandom(i) implicit none real*8 frandom integer*4 i 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 integer*4 ix, iy, iz common /randc/ ix, iy, iz c ix = mod(171 * ix, 30269) iy = mod(172 * iy, 30307) iz = mod(170 * iz, 30323) frandom = mod(dble(ix) / 30269.0d0 + dble(iy) / 30307.0d0 + 1 dble(iz) / 30323.0d0, 1.0d0) return end