! $Id: ran1.f90 5105 2024-07-23 17:14:34Z abarral $ FUNCTION RAN1(IDUM) IMPLICIT NONE REAL :: RAN1 REAL,SAVE :: R(97) REAL,PARAMETER :: RM1=3.8580247E-6,RM2=7.4373773E-6 INTEGER,SAVE :: IFF=0 integer,save :: ix1,ix2,ix3 INTEGER,PARAMETER :: M1=259200,IA1=7141,IC1=54773 INTEGER,PARAMETER :: M2=134456,IA2=8121,IC2=28411 INTEGER,PARAMETER :: M3=243000,IA3=4561,IC3=51349 INTEGER :: IDUM,J IF (IDUM<0.OR.IFF==0) THEN IFF=1 IX1=MOD(IC1-IDUM,M1) IX1=MOD(IA1*IX1+IC1,M1) IX2=MOD(IX1,M2) IX1=MOD(IA1*IX1+IC1,M1) IX3=MOD(IX1,M3) DO J=1,97 IX1=MOD(IA1*IX1+IC1,M1) IX2=MOD(IA2*IX2+IC2,M2) R(J)=(REAL(IX1)+REAL(IX2)*RM2)*RM1 END DO IDUM=1 ENDIF IX1=MOD(IA1*IX1+IC1,M1) IX2=MOD(IA2*IX2+IC2,M2) IX3=MOD(IA3*IX3+IC3,M3) J=1+(97*IX3)/M3 IF(J>97.OR.J<1) stop 1 RAN1=R(J) R(J)=(REAL(IX1)+REAL(IX2)*RM2)*RM1 END FUNCTION RAN1