00001 SUBROUTINE inrgcm() 00002 C********************************************************************** 00003 C 00004 C SUBROUTINE INRGCM() 00005 C INitialize Random number Generator CoMmon 00006 C 00007 C 00008 C Function 00009 C 00010 C 00011 C Initializes common area for random number generator. This saves 00012 C the nuisance of a BLOCK DATA routine and the difficulty of 00013 C assuring that the routine is loaded with the other routines. 00014 C 00015 C********************************************************************** 00016 C .. Parameters .. 00017 INTEGER numg 00018 PARAMETER (numg=32) 00019 C .. 00020 C .. Scalars in Common .. 00021 INTEGER a1,a1vw,a1w,a2,a2vw,a2w,m1,m2 00022 C .. 00023 C .. Arrays in Common .. 00024 INTEGER cg1(numg),cg2(numg),ig1(numg),ig2(numg),lg1(numg), 00025 + lg2(numg) 00026 LOGICAL qanti(numg) 00027 C .. 00028 C .. Local Scalars .. 00029 INTEGER i 00030 LOGICAL qdum 00031 C .. 00032 C .. External Functions .. 00033 LOGICAL qrgnsn 00034 EXTERNAL qrgnsn 00035 C .. 00036 C .. Common blocks .. 00037 COMMON /globe/m1,m2,a1,a2,a1w,a2w,a1vw,a2vw,ig1,ig2,lg1,lg2,cg1, 00038 + cg2,qanti 00039 C .. 00040 C .. Save statement .. 00041 SAVE /globe/ 00042 C .. 00043 C .. Executable Statements .. 00044 C V=20; W=30; 00045 C 00046 C A1W = MOD(A1**(2**W),M1) A2W = MOD(A2**(2**W),M2) 00047 C A1VW = MOD(A1**(2**(V+W)),M1) A2VW = MOD(A2**(2**(V+W)),M2) 00048 C 00049 C If V or W is changed A1W, A2W, A1VW, and A2VW need to be recomputed. 00050 C An efficient way to precompute a**(2*j) MOD m is to start with 00051 C a and square it j times modulo m using the function MLTMOD. 00052 C 00053 m1 = 2147483563 00054 m2 = 2147483399 00055 a1 = 40014 00056 a2 = 40692 00057 a1w = 1033780774 00058 a2w = 1494757890 00059 a1vw = 2082007225 00060 a2vw = 784306273 00061 DO 10,i = 1,numg 00062 qanti(i) = .FALSE. 00063 10 CONTINUE 00064 C 00065 C Tell the world that common has been initialized 00066 C 00067 qdum = qrgnsn(.TRUE.) 00068 RETURN 00069 00070 END