(file) Return to ranecu.f CVS log (file) (dir) Up to [HallC] / pol_hms_single

 1 jones 1.1 C
 2           C ----------------------------------------------------------------
 3           C     Subroutine RANECU
 4           C
 5           C     Portable random number generator proposed by l'Ecuyer
 6           C                 in Commun. ACM 31 (1988) 743.
 7           C     slightly modified by F. James, 1988, to generate a vector
 8           C     of pseudorandom numbers RVEC of length LEN.
 9           C     Listing Published in Computer Physics COmm. 60 (1990) 329.
10           C     Typed in by S. A. Wood, CEBAF 1/23/91 with strong typing.
11           C ----------------------------------------------------------------
12           C
13                 SUBROUTINE RANECU(RVEC,LEN)
14                 IMPLICIT NONE
15           C
16                 REAL RVEC(*)
17                 INTEGER LEN,ISEED1,ISEED2
18                 INTEGER I,K,IZ,IS1,IS2
19           C
20                 SAVE ISEED1,ISEED2
21                 DATA ISEED1,ISEED2/12345,67890/
22 jones 1.1 C
23                 DO I=1,LEN
24                   K = ISEED1/53668
25                   ISEED1 = 40014*(ISEED1-K*53668)-K*12211
26                   IF(ISEED1.LT.0) ISEED1 = ISEED1+2147483563
27           C
28                   K = ISEED2/52774
29                   ISEED2 = 40692*(ISEED2-K*52774)-K*3791
30                   IF(ISEED2.LT.0) ISEED2 = ISEED2+2147483399
31           C
32                   IZ = ISEED1 - ISEED2
33                   IF(IZ.LT.1) IZ = IZ + 2147483562
34           C
35                   RVEC(I) = REAL(IZ)*4.656613E-10
36                 ENDDO
37                 RETURN
38           C
39           C     Initialize seeds.
40           C
41                 ENTRY RECUIN(IS1,IS2)
42                 ISEED1 = IS1
43 jones 1.1       ISEED2 = IS2
44                 RETURN
45           C
46           C     Get current seeds.
47           C
48                 ENTRY RECUUT(IS1,IS2)
49                 IS1 = ISEED1
50                 IS2 = ISEED2
51                 RETURN
52           C
53                 END

Analyzer/Replay: Mark Jones, Documents: Stephen Wood
Powered by
ViewCVS 0.9.2-cvsgraph-1.4.0