source: LMDZ.3.3/trunk/libf/dyn3d/ran1.F @ 5

Last change on this file since 5 was 2, checked in by lmdz, 25 years ago

Initial revision

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