GNU Octave  4.0.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
inrgcm.f
Go to the documentation of this file.
1  SUBROUTINE inrgcm()
2 C**********************************************************************
3 C
4 C SUBROUTINE INRGCM()
5 C INitialize Random number Generator CoMmon
6 C
7 C
8 C Function
9 C
10 C
11 C Initializes common area for random number generator. This saves
12 C the nuisance of a BLOCK DATA routine and the difficulty of
13 C assuring that the routine is loaded with the other routines.
14 C
15 C**********************************************************************
16 C .. Parameters ..
17  INTEGER numg
18  parameter(numg=32)
19 C ..
20 C .. Scalars in Common ..
21  INTEGER a1,a1vw,a1w,a2,a2vw,a2w,m1,m2
22 C ..
23 C .. Arrays in Common ..
24  INTEGER cg1(numg),cg2(numg),ig1(numg),ig2(numg),lg1(numg),
25  + lg2(numg)
26  LOGICAL qanti(numg)
27 C ..
28 C .. Local Scalars ..
29  INTEGER i
30  LOGICAL qdum
31 C ..
32 C .. External Functions ..
33  LOGICAL qrgnsn
34  EXTERNAL qrgnsn
35 C ..
36 C .. Common blocks ..
37  COMMON /globe/m1,m2,a1,a2,a1w,a2w,a1vw,a2vw,ig1,ig2,lg1,lg2,cg1,
38  + cg2,qanti
39 C ..
40 C .. Save statement ..
41  SAVE /globe/
42 C ..
43 C .. Executable Statements ..
44 C V=20; W=30;
45 C
46 C A1W = MOD(A1**(2**W),M1) A2W = MOD(A2**(2**W),M2)
47 C A1VW = MOD(A1**(2**(V+W)),M1) A2VW = MOD(A2**(2**(V+W)),M2)
48 C
49 C If V or W is changed A1W, A2W, A1VW, and A2VW need to be recomputed.
50 C An efficient way to precompute a**(2*j) MOD m is to start with
51 C a and square it j times modulo m using the function MLTMOD.
52 C
53  m1 = 2147483563
54  m2 = 2147483399
55  a1 = 40014
56  a2 = 40692
57  a1w = 1033780774
58  a2w = 1494757890
59  a1vw = 2082007225
60  a2vw = 784306273
61  DO 10,i = 1,numg
62  qanti(i) = .false.
63  10 CONTINUE
64 C
65 C Tell the world that common has been initialized
66 C
67  qdum = qrgnsn(.true.)
68  RETURN
69 
70  END
subroutine inrgcm()
Definition: inrgcm.f:1