program makemat c makes a symmetric matrix integer*4 i,j,ix,iy,iz,N real*8 frandom common /randc/ ix, iy, iz real*8,allocatable::a(:,:) write(6,*)'N:' read(5,*)N allocate(a(N,N)) write(6,*)'allocated' ix=1 iy=1000 iz=99 do 1 i=1,N do 1 j=1,i a(i,j)=frandom(i)*i 1 a(j,i)=a(i,j) write(6,*)'filled' open(8,file='A.SCR',form='unformatted') write(8)N write(8)a close(8) write(6,*)'written' 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