source: LMDZ4/trunk/libf/dyn3d/ran1.F @ 843

Last change on this file since 843 was 524, checked in by lmdzadmin, 21 years ago

Initial revision

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 897 bytes
Line 
1!
2! $Header$
3!
4      FUNCTION RAN1(IDUM)
5      DIMENSION R(97)
6      save r
7      save iff,ix1,ix2,ix3
8      PARAMETER (M1=259200,IA1=7141,IC1=54773,RM1=3.8580247E-6)
9      PARAMETER (M2=134456,IA2=8121,IC2=28411,RM2=7.4373773E-6)
10      PARAMETER (M3=243000,IA3=4561,IC3=51349)
11      DATA IFF /0/
12      IF (IDUM.LT.0.OR.IFF.EQ.0) THEN
13        IFF=1
14        IX1=MOD(IC1-IDUM,M1)
15        IX1=MOD(IA1*IX1+IC1,M1)
16        IX2=MOD(IX1,M2)
17        IX1=MOD(IA1*IX1+IC1,M1)
18        IX3=MOD(IX1,M3)
19        DO 11 J=1,97
20          IX1=MOD(IA1*IX1+IC1,M1)
21          IX2=MOD(IA2*IX2+IC2,M2)
22          R(J)=(FLOAT(IX1)+FLOAT(IX2)*RM2)*RM1
2311      CONTINUE
24        IDUM=1
25      ENDIF
26      IX1=MOD(IA1*IX1+IC1,M1)
27      IX2=MOD(IA2*IX2+IC2,M2)
28      IX3=MOD(IA3*IX3+IC3,M3)
29      J=1+(97*IX3)/M3
30      IF(J.GT.97.OR.J.LT.1)PAUSE
31      RAN1=R(J)
32      R(J)=(FLOAT(IX1)+FLOAT(IX2)*RM2)*RM1
33      RETURN
34      END
Note: See TracBrowser for help on using the repository browser.