# Random Number Generator Study (RANECU, GRNDM)

## GRNDM, GRNDMQ, RANECU, RANECQ patches

What follows are extracts from the Geant library and the Cern library referenced by the RDIV Vax, Alpha cluster at FNAL. They are from the "CAR" files containing code in Patchy format. From these CAR files have been extracted the patches for the four routines mentioned in the heading.

The patches have been put together in one document, and hypertext links have been inserted to jump tothe places of interest. Also present are hypertext links to jump back to the list of links at the top of the document.

```
go to start of document
SUBROUTINE GRNDM(RVEC,LEN)
C.
C.
*************************************************************
*****
C.    *
*
C.    *       To generate a vector RVECV of LEN random
numbers         *
C.    *         Copy of the CERN Library routine RANECU
*
C.    *
*
C.    *    ==>Called by : , many GEANT routines
*
C.    *       Author    F.Carminati *********
*
C.    *
*
C.
*************************************************************
*****
C.
+SELF,IF=CRAY
CDIR\$ STACK
+SELF
DIMENSION RVEC(*)
+SELF,IF=CRAY
REAL ISEED, ISEED1, ISEED2, K, C1, C2, IZ
+SELF,IF=IBMALL,IBMRT,APO10K,HPUX, MSDOS,WINNT.
DOUBLE PRECISION ISEED, ISEED1, ISEED2, K, C1, C2, IZ
+SELF,IF=IBMALL,IBMRT,CRAY,APO10K,HPUX,MSDOS,WINNT.
PARAMETER (C1=1./53668.,C2=1./52774.)
+SELF
PARAMETER  (MAXSEQ=215)

go to start of document
COMMON / GCRNDM / JSEQ(2), ISEED(2,MAXSEQ)
C
ISEQ   = JSEQ(1)
ISEED1 = ISEED(1,ISEQ)
ISEED2 = ISEED(2,ISEQ)
DO 100 I= 1, LEN
+SELF,IF=APOLLO,VAX,SUN,SGI,DECS,CONVEX,IPSC.
K = ISEED1/53668
+SELF,IF=IBMALL,IBMRT,CRAY,APO10K,HPUX,MSDOS,WINNT.
K = INT(ISEED1*C1)
+SELF

go to start of document
ISEED1 = 40014*(ISEED1 - K*53668) - K*12211
IF (ISEED1 .LT. 0) ISEED1=ISEED1+2147483563
C
+SELF,IF=APOLLO,VAX,SUN,SGI,DECS,CONVEX,IPSC.
K = ISEED2/52774
+SELF,IF=IBMALL,IBMRT,CRAY,APO10K,HPUX, MSDOS, WINNT.
K = INT(ISEED2*C2)
+SELF

go to start of document
ISEED2 = 40692*(ISEED2 - K*52774) - K* 3791
IF (ISEED2 .LT. 0) ISEED2=ISEED2+2147483399
C
IZ = ISEED1 - ISEED2
IF (IZ .LE. 0)  IZ = IZ + 2147483562
C
RVEC(I) = IZ * 4.6566128E-10
100 CONTINUE
ISEED(1,ISEQ) = ISEED1
ISEED(2,ISEQ) = ISEED2
END
+DECK,GRNDMQ.
*CMZ :  3.21/04 31/10/94  10.11.27  by  S.Ravndal
*-- Author :

go to start of document
SUBROUTINE GRNDMQ(IS1,IS2,ISEQ,CHOPT)
C.
C.
*************************************************************
*****
C.    *
*
C.    *       To set/retrieve the seed of the random number
generator  *
C.    *        Copy of the CERN Library routine RECUSQ
*
C.    *        Each sequence has a period of 10**9 numbers
*
C.    *
*
C.    *    ==>Called by : , many GEANT routines
*
C.    *       Author    R.Brun, F.Carminati  *********
*
C.    *
*
C.
*************************************************************
*****
C.
+SEQ,GCBANK
CHARACTER*(*) CHOPT
CHARACTER*12  CCHOPT
+SELF,IF=CRAY
REAL ISEED
+SELF,IF=IBMALL,IBMRT,APO10K,HPUX,MSDOS,WINNT.
DOUBLE PRECISION ISEED
+SELF
PARAMETER  (MAXSEQ=215)
COMMON / GCRNDM / JSEQ(2), ISEED(2,MAXSEQ)
DIMENSION  LSEQS(2,MAXSEQ)

go to start of document
DATA LSEQS(1,  1),LSEQS(2,  1 )/      9876,     54321/
DATA LSEQS(1,  2),LSEQS(2,  2 )/1299961164, 253987020/
DATA LSEQS(1,  3),LSEQS(2,  3 )/ 669708517,2079157264/
DATA LSEQS(1,  4),LSEQS(2,  4 )/ 190904760, 417696270/
DATA LSEQS(1,  5),LSEQS(2,  5 )/1289741558,1376336092/
DATA LSEQS(1,  6),LSEQS(2,  6 )/1803730167, 324952955/
DATA LSEQS(1,  7),LSEQS(2,  7 )/ 489854550, 582847132/
DATA LSEQS(1,  8),LSEQS(2,  8 )/1348037628,1661577989/
DATA LSEQS(1,  9),LSEQS(2,  9 )/ 350557787,1155446919/
DATA LSEQS(1, 10),LSEQS(2, 10 )/ 591502945, 634133404/
DATA LSEQS(1, 11),LSEQS(2, 11 )/1901084678, 862916278/
DATA LSEQS(1, 12),LSEQS(2, 12 )/1988640932,1785523494/
DATA LSEQS(1, 13),LSEQS(2, 13 )/1873836227, 508007031/
DATA LSEQS(1, 14),LSEQS(2, 14 )/1146416592, 967585720/
DATA LSEQS(1, 15),LSEQS(2, 15 )/1837193353,1522927634/
DATA LSEQS(1, 16),LSEQS(2, 16 )/  38219936, 921609208/
DATA LSEQS(1, 17),LSEQS(2, 17 )/ 349152748, 112892610/
DATA LSEQS(1, 18),LSEQS(2, 18 )/ 744459040,1735807920/
DATA LSEQS(1, 19),LSEQS(2, 19 )/1983990104, 728277902/
DATA LSEQS(1, 20),LSEQS(2, 20 )/ 309164507,2126677523/
DATA LSEQS(1, 21),LSEQS(2, 21 )/ 362993787,1897782044/
DATA LSEQS(1, 22),LSEQS(2, 22 )/ 556776976, 462072869/
DATA LSEQS(1, 23),LSEQS(2, 23 )/1584900822,2019394912/
DATA LSEQS(1, 24),LSEQS(2, 24 )/1249892722, 791083656/
DATA LSEQS(1, 25),LSEQS(2, 25 )/1686600998,1983731097/
DATA LSEQS(1, 26),LSEQS(2, 26 )/1127381380, 198976625/
DATA LSEQS(1, 27),LSEQS(2, 27 )/1999420861,1810452455/
DATA LSEQS(1, 28),LSEQS(2, 28 )/1972906041, 664182577/
DATA LSEQS(1, 29),LSEQS(2, 29 )/  84636481,1291886301/
DATA LSEQS(1, 30),LSEQS(2, 30 )/1186362995, 954388413/
DATA LSEQS(1, 31),LSEQS(2, 31 )/2141621785,  61738584/
DATA LSEQS(1, 32),LSEQS(2, 32 )/1969581251,1557880415/
DATA LSEQS(1, 33),LSEQS(2, 33 )/1150606439, 136325185/
DATA LSEQS(1, 34),LSEQS(2, 34 )/  95187861,1592224108/
DATA LSEQS(1, 35),LSEQS(2, 35 )/ 940517655,1629971798/
DATA LSEQS(1, 36),LSEQS(2, 36 )/ 215350428, 922659102/
DATA LSEQS(1, 37),LSEQS(2, 37 )/ 786161212,1121345074/
DATA LSEQS(1, 38),LSEQS(2, 38 )/1450830056,1922787776/
DATA LSEQS(1, 39),LSEQS(2, 39 )/1696578057,2025150487/
DATA LSEQS(1, 40),LSEQS(2, 40 )/1803414346,1851324780/
DATA LSEQS(1, 41),LSEQS(2, 41 )/1017898585,1452594263/
DATA LSEQS(1, 42),LSEQS(2, 42 )/1184497978,  82122239/
DATA LSEQS(1, 43),LSEQS(2, 43 )/ 633338765,1829684974/
DATA LSEQS(1, 44),LSEQS(2, 44 )/ 430889421, 230039326/
DATA LSEQS(1, 45),LSEQS(2, 45 )/ 492544653,  76320266/
DATA LSEQS(1, 46),LSEQS(2, 46 )/ 389386975,1314148944/
DATA LSEQS(1, 47),LSEQS(2, 47 )/1720322786, 709120323/
DATA LSEQS(1, 48),LSEQS(2, 48 )/1868768216,1992898523/
DATA LSEQS(1, 49),LSEQS(2, 49 )/ 443210610, 811117710/
DATA LSEQS(1, 50),LSEQS(2, 50 )/1191938868,1548484733/
DATA LSEQS(1, 51),LSEQS(2, 51 )/ 616890172, 159787986/
DATA LSEQS(1, 52),LSEQS(2, 52 )/ 935835339,1231440405/
DATA LSEQS(1, 53),LSEQS(2, 53 )/1058009367,1527613300/
DATA LSEQS(1, 54),LSEQS(2, 54 )/1463148129,1970575097/
DATA LSEQS(1, 55),LSEQS(2, 55 )/1795336935, 434768675/
DATA LSEQS(1, 56),LSEQS(2, 56 )/ 274019517, 605098487/
DATA LSEQS(1, 57),LSEQS(2, 57 )/ 483689317, 217146977/
DATA LSEQS(1, 58),LSEQS(2, 58 )/2070804364, 340596558/
DATA LSEQS(1, 59),LSEQS(2, 59 )/ 930226308,1602100969/
DATA LSEQS(1, 60),LSEQS(2, 60 )/ 989324440, 801809442/
DATA LSEQS(1, 61),LSEQS(2, 61 )/ 410606853,1893139948/
DATA LSEQS(1, 62),LSEQS(2, 62 )/1583588576,1219225407/
DATA LSEQS(1, 63),LSEQS(2, 63 )/2102034391,1394921405/
DATA LSEQS(1, 64),LSEQS(2, 64 )/2005037790,2031006861/
DATA LSEQS(1, 65),LSEQS(2, 65 )/1244218766, 923231061/
DATA LSEQS(1, 66),LSEQS(2, 66 )/  49312790, 775496649/
DATA LSEQS(1, 67),LSEQS(2, 67 )/ 721012176, 321339902/
DATA LSEQS(1, 68),LSEQS(2, 68 )/1719909107,1865748178/
DATA LSEQS(1, 69),LSEQS(2, 69 )/1156177430,1257110891/
DATA LSEQS(1, 70),LSEQS(2, 70 )/ 307561322,1918244397/
DATA LSEQS(1, 71),LSEQS(2, 71 )/ 906041433, 360476981/
DATA LSEQS(1, 72),LSEQS(2, 72 )/1591375755, 268492659/
DATA LSEQS(1, 73),LSEQS(2, 73 )/ 461522398, 227343256/
DATA LSEQS(1, 74),LSEQS(2, 74 )/2145930725,2020665454/
DATA LSEQS(1, 75),LSEQS(2, 75 )/1938419274,1331283701/
DATA LSEQS(1, 76),LSEQS(2, 76 )/ 174405412, 524140103/
DATA LSEQS(1, 77),LSEQS(2, 77 )/ 494343653,  18063908/
DATA LSEQS(1, 78),LSEQS(2, 78 )/1025534808, 181709577/
DATA LSEQS(1, 79),LSEQS(2, 79 )/2048959776,1913665637/
DATA LSEQS(1, 80),LSEQS(2, 80 )/ 950636517, 794796256/
DATA LSEQS(1, 81),LSEQS(2, 81 )/1828843197,1335757744/
DATA LSEQS(1, 82),LSEQS(2, 82 )/ 211109723, 983900607/
DATA LSEQS(1, 83),LSEQS(2, 83 )/ 825474095,1046009991/
DATA LSEQS(1, 84),LSEQS(2, 84 )/ 374915657, 381856628/
DATA LSEQS(1, 85),LSEQS(2, 85 )/1241296328, 698149463/
DATA LSEQS(1, 86),LSEQS(2, 86 )/1260624655,1024538273/
DATA LSEQS(1, 87),LSEQS(2, 87 )/ 900676210,1628865823/
DATA LSEQS(1, 88),LSEQS(2, 88 )/ 697951025, 500570753/
DATA LSEQS(1, 89),LSEQS(2, 89 )/1007920268,1708398558/
DATA LSEQS(1, 90),LSEQS(2, 90 )/ 264596520, 624727803/
DATA LSEQS(1, 91),LSEQS(2, 91 )/1977924811, 674673241/
DATA LSEQS(1, 92),LSEQS(2, 92 )/1440257718, 271184151/
DATA LSEQS(1, 93),LSEQS(2, 93 )/1928778847, 993535203/
DATA LSEQS(1, 94),LSEQS(2, 94 )/1307807366,1801502463/
DATA LSEQS(1, 95),LSEQS(2, 95 )/1498732610, 300876954/
DATA LSEQS(1, 96),LSEQS(2, 96 )/1617712402,1574250679/
DATA LSEQS(1, 97),LSEQS(2, 97 )/1261800762,1556667280/
DATA LSEQS(1, 98),LSEQS(2, 98 )/ 949929273, 560721070/
DATA LSEQS(1, 99),LSEQS(2, 99 )/1766170474,1953522912/
DATA LSEQS(1,100),LSEQS(2,100 )/1849939248,  19435166/
DATA LSEQS(1,101),LSEQS(2,101 )/ 887262858,1219627824/
DATA LSEQS(1,102),LSEQS(2,102 )/ 483086133, 603728993/
DATA LSEQS(1,103),LSEQS(2,103 )/1330541052,1582596025/
DATA LSEQS(1,104),LSEQS(2,104 )/1850591475, 723593133/
DATA LSEQS(1,105),LSEQS(2,105 )/1431775678,1558439000/
DATA LSEQS(1,106),LSEQS(2,106 )/ 922493739,1356554404/
DATA LSEQS(1,107),LSEQS(2,107 )/1058517206, 948567762/
DATA LSEQS(1,108),LSEQS(2,108 )/ 709067283,1350890215/
DATA LSEQS(1,109),LSEQS(2,109 )/1044787723,2144304941/
DATA LSEQS(1,110),LSEQS(2,110 )/ 999707003, 513837520/
DATA LSEQS(1,111),LSEQS(2,111 )/2140038663,1850568788/
DATA LSEQS(1,112),LSEQS(2,112 )/1803100150, 127574047/
DATA LSEQS(1,113),LSEQS(2,113 )/ 867445693,1149173981/
DATA LSEQS(1,114),LSEQS(2,114 )/ 408583729, 914837991/
DATA LSEQS(1,115),LSEQS(2,115 )/1166715497, 602315845/
DATA LSEQS(1,116),LSEQS(2,116 )/ 430738528,1743308384/
DATA LSEQS(1,117),LSEQS(2,117 )/1388022681,1760110496/
DATA LSEQS(1,118),LSEQS(2,118 )/1664028066, 654300326/
DATA LSEQS(1,119),LSEQS(2,119 )/1767741172,1338181197/
DATA LSEQS(1,120),LSEQS(2,120 )/1625723550,1742482745/
DATA LSEQS(1,121),LSEQS(2,121 )/ 464486085,1507852127/
DATA LSEQS(1,122),LSEQS(2,122 )/ 754082421,1187454014/
DATA LSEQS(1,123),LSEQS(2,123 )/1315342834, 425995190/
DATA LSEQS(1,124),LSEQS(2,124 )/ 960416608,2004255418/
DATA LSEQS(1,125),LSEQS(2,125 )/1262630671, 671761697/
DATA LSEQS(1,126),LSEQS(2,126 )/  59809238, 103525918/
DATA LSEQS(1,127),LSEQS(2,127 )/1205644919,2107823293/
DATA LSEQS(1,128),LSEQS(2,128 )/1615183160,1152411412/
DATA LSEQS(1,129),LSEQS(2,129 )/1024474681,2118672937/
DATA LSEQS(1,130),LSEQS(2,130 )/1703877649,1235091369/
DATA LSEQS(1,131),LSEQS(2,131 )/1821417852,1098463802/
DATA LSEQS(1,132),LSEQS(2,132 )/1738806466,1529062843/
DATA LSEQS(1,133),LSEQS(2,133 )/ 620780646,1654833544/
DATA LSEQS(1,134),LSEQS(2,134 )/1070174101, 795158254/
DATA LSEQS(1,135),LSEQS(2,135 )/ 658537995,1693620426/
DATA LSEQS(1,136),LSEQS(2,136 )/2055317555, 508053916/
DATA LSEQS(1,137),LSEQS(2,137 )/1647371686,1282395762/
DATA LSEQS(1,138),LSEQS(2,138 )/  29067379, 409683067/
DATA LSEQS(1,139),LSEQS(2,139 )/1763495989,1917939635/
DATA LSEQS(1,140),LSEQS(2,140 )/1602690753, 810926582/
DATA LSEQS(1,141),LSEQS(2,141 )/ 885787576, 513818500/
DATA LSEQS(1,142),LSEQS(2,142 )/1853512561,1195205756/
DATA LSEQS(1,143),LSEQS(2,143 )/1798585498,1970460256/
DATA LSEQS(1,144),LSEQS(2,144 )/1819261032,1306536501/
DATA LSEQS(1,145),LSEQS(2,145 )/1133245275,     37901/
DATA LSEQS(1,146),LSEQS(2,146 )/ 689459799,1334389069/
DATA LSEQS(1,147),LSEQS(2,147 )/1730609912,1854586207/
DATA LSEQS(1,148),LSEQS(2,148 )/1556832175,1228729041/
DATA LSEQS(1,149),LSEQS(2,149 )/ 251375753, 683687209/
DATA LSEQS(1,150),LSEQS(2,150 )/2083946182,1763106152/
DATA LSEQS(1,151),LSEQS(2,151 )/2142981854,1365385561/
DATA LSEQS(1,152),LSEQS(2,152 )/ 763711891,1735754548/
DATA LSEQS(1,153),LSEQS(2,153 )/1581256466, 173689858/
DATA LSEQS(1,154),LSEQS(2,154 )/2121337132,1247108250/
DATA LSEQS(1,155),LSEQS(2,155 )/1004003636, 891894307/
DATA LSEQS(1,156),LSEQS(2,156 )/ 569816524, 358675254/
DATA LSEQS(1,157),LSEQS(2,157 )/ 626626425, 116062841/
DATA LSEQS(1,158),LSEQS(2,158 )/ 632086003, 861268491/
DATA LSEQS(1,159),LSEQS(2,159 )/1008211580, 779404957/
DATA LSEQS(1,160),LSEQS(2,160 )/1134217766,1766838261/
DATA LSEQS(1,161),LSEQS(2,161 )/1423829292,1706666192/
DATA LSEQS(1,162),LSEQS(2,162 )/ 942037869,1549358884/
DATA LSEQS(1,163),LSEQS(2,163 )/1959429535, 480779114/
DATA LSEQS(1,164),LSEQS(2,164 )/ 778311037,1940360875/
DATA LSEQS(1,165),LSEQS(2,165 )/1531372185,2009078158/
DATA LSEQS(1,166),LSEQS(2,166 )/ 241935492,1050047003/
DATA LSEQS(1,167),LSEQS(2,167 )/ 272453504,1870883868/
DATA LSEQS(1,168),LSEQS(2,168 )/ 390441332,1057903098/
DATA LSEQS(1,169),LSEQS(2,169 )/1230238834,1548117688/
DATA LSEQS(1,170),LSEQS(2,170 )/1242956379,1217296445/
DATA LSEQS(1,171),LSEQS(2,171 )/ 515648357,1675011378/
DATA LSEQS(1,172),LSEQS(2,172 )/ 364477932, 355212934/
DATA LSEQS(1,173),LSEQS(2,173 )/2096008713,1570161804/
DATA LSEQS(1,174),LSEQS(2,174 )/1409752526, 214033983/
DATA LSEQS(1,175),LSEQS(2,175 )/1288158292,1760636178/
DATA LSEQS(1,176),LSEQS(2,176 )/ 407562666,1265144848/
DATA LSEQS(1,177),LSEQS(2,177 )/1071056491,1582316946/
DATA LSEQS(1,178),LSEQS(2,178 )/1014143949, 911406955/
DATA LSEQS(1,179),LSEQS(2,179 )/ 203080461, 809380052/
DATA LSEQS(1,180),LSEQS(2,180 )/ 125647866,1705464126/
DATA LSEQS(1,181),LSEQS(2,181 )/2015685843, 599230667/
DATA LSEQS(1,182),LSEQS(2,182 )/1425476020, 668203729/
DATA LSEQS(1,183),LSEQS(2,183 )/1673735652, 567931803/
DATA LSEQS(1,184),LSEQS(2,184 )/1714199325, 181737617/
DATA LSEQS(1,185),LSEQS(2,185 )/1389137652, 678147926/
DATA LSEQS(1,186),LSEQS(2,186 )/ 288547803, 435433694/
DATA LSEQS(1,187),LSEQS(2,187 )/ 200159281, 654399753/
DATA LSEQS(1,188),LSEQS(2,188 )/1580828223,1298308945/
DATA LSEQS(1,189),LSEQS(2,189 )/1832286107, 169991953/
DATA LSEQS(1,190),LSEQS(2,190 )/ 182557704,1046541065/
DATA LSEQS(1,191),LSEQS(2,191 )/1688025575,1248944426/
DATA LSEQS(1,192),LSEQS(2,192 )/1508287706,1220577001/
DATA LSEQS(1,193),LSEQS(2,193 )/  36721212,1377275347/
DATA LSEQS(1,194),LSEQS(2,194 )/1968679856,1675229747/
DATA LSEQS(1,195),LSEQS(2,195 )/ 279109231,1835333261/
DATA LSEQS(1,196),LSEQS(2,196 )/1358617667,1416978076/
DATA LSEQS(1,197),LSEQS(2,197 )/ 740626186,2103913602/
DATA LSEQS(1,198),LSEQS(2,198 )/1882655908, 251341858/
DATA LSEQS(1,199),LSEQS(2,199 )/ 648016670,1459615287/
DATA LSEQS(1,200),LSEQS(2,200 )/ 780255321, 154906988/
DATA LSEQS(1,201),LSEQS(2,201 )/ 857296483, 203375965/
DATA LSEQS(1,202),LSEQS(2,202 )/1631676846, 681204578/
DATA LSEQS(1,203),LSEQS(2,203 )/1906971307,1623728832/
DATA LSEQS(1,204),LSEQS(2,204 )/1541899600,1168449797/
DATA LSEQS(1,205),LSEQS(2,205 )/1267051693,1020078717/
DATA LSEQS(1,206),LSEQS(2,206 )/1998673940,1298394942/
DATA LSEQS(1,207),LSEQS(2,207 )/1914117058,1381290704/
DATA LSEQS(1,208),LSEQS(2,208 )/ 426068513,1381618498/
DATA LSEQS(1,209),LSEQS(2,209 )/ 139365577,1598767734/
DATA LSEQS(1,210),LSEQS(2,210 )/2129910384, 952266588/
DATA LSEQS(1,211),LSEQS(2,211 )/ 661788054,  19661356/
DATA LSEQS(1,212),LSEQS(2,212 )/1104640222, 240506063/
DATA LSEQS(1,213),LSEQS(2,213 )/ 356133630,1676634527/
DATA LSEQS(1,214),LSEQS(2,214 )/ 242242374,1863206182/
DATA LSEQS(1,215),LSEQS(2,215 )/ 957935844,1490681416/
C
CCHOPT = CHOPT

IF(CCHOPT.EQ.' ') THEN
IF(ISEQ.GT.215.OR.ISEQ.LT.1) THEN
ISEED(1,1) = LSEQS(1,1)
ISEED(2,1) = LSEQS(2,1)
JSEQ(1)    = 1
ELSE
ISEED(1,ISEQ) = LSEQS(1,ISEQ)
ISEED(2,ISEQ) = LSEQS(2,ISEQ)
JSEQ(1)    = ISEQ
END IF
GO TO 999
END IF
IF(INDEX(CHOPT,'S').NE.0) THEN
IF(ISEQ.GT.0) JSEQ(1) = ISEQ
IF(IS1.GT.0.AND.IS2.GT.0) THEN
ISEED(1,JSEQ(1)) = IS1
ISEED(2,JSEQ(1)) = IS2
END IF
IF(INDEX(CHOPT,'H').NE.0) THEN
END IF
END IF

IF(INDEX(CHOPT,'G').NE.0) THEN
IF(ISEQ.LE.0)THEN
KSEQ = JSEQ(1)
ELSE
KSEQ = ISEQ
ENDIF
IS1 = ISEED(1,KSEQ)
IS2 = ISEED(2,KSEQ)
END IF
IF(INDEX(CHOPT,'Q').NE.0) THEN
IF(ISEQ.GE.1.AND.ISEQ.LE.MAXSEQ) THEN
IS1 = LSEQS(1,ISEQ)
IS2 = LSEQS(2,ISEQ)
ELSE
IS1 = 0
IS2 = 0
END IF
END IF
C
999  END
+DECK, RANECU.

go to start of document
SUBROUTINE RANECU(RVEC,LEN,KSEQ)
+SELF, IF=QMCRY.
CDIR\$ STACK
+SELF
C
C CERN PROGLIB# V114    RANECU          .VERSION KERNFOR
4.21  890323
C ORIG. 01/03/89 FCA + FJ
C
+SELF, IF=QMCRY.
REAL             ISEED, ISEED1, ISEED2, K, C1, C2, IZ
+SELF, IF=QMIBM, QMIBX, QMAPO10.
DOUBLE PRECISION ISEED, ISEED1, ISEED2, K, C1, C2, IZ
+SELF, IF=QMIBM, QMIBX, QMCRY, QMAPO10.
PARAMETER (C1=(1.D0+1.D-11)/53668.D0,C2=(1.D0+1.D-
11)/52774.D0)
+SELF.
PARAMETER  (MAXSEQ=100)
DIMENSION RVEC(*)

go to start of document
COMMON / RANEC1 / JSEQ(2), ISEED(2,MAXSEQ)
SAVE /RANEC1/
C
IF(KSEQ.GT.0) THEN
JSEQ(1) = KSEQ
ISEQ    = KSEQ
ELSE
ISEQ   = JSEQ(1)
ENDIF
ISEED1 = ISEED(1,ISEQ)
ISEED2 = ISEED(2,ISEQ)
DO 100 I= 1, LEN
+SELF, V114SEQ1.
K = ISEED1/53668
+SELF.

go to start of document
ISEED1 = 40014*(ISEED1 - K*53668) - K*12211
IF (ISEED1 .LT. 0) ISEED1=ISEED1+2147483563
C
+SELF, V114SEQ2.
K = ISEED2/52774
+SELF.
ISEED2 = 40692*(ISEED2 - K*52774) - K* 3791
IF (ISEED2 .LT. 0) ISEED2=ISEED2+2147483399
C
IZ = ISEED1 - ISEED2
IF (IZ .LE. 0)  IZ = IZ + 2147483562
C
RVEC(I) = IZ * 4.6566128E-10
100 CONTINUE
ISEED(1,ISEQ) = ISEED1
ISEED(2,ISEQ) = ISEED2
END
C
+DECK, RANECQ.

go to start of document
SUBROUTINE RANECQ(IS1,IS2,ISEQ,CHOPT)
C
C CERN PROGLIB# V114    RANECQ          .VERSION KERNFOR
4.21  890323
C ORIG. 01/03/89 FCA + FJ
C
CHARACTER*(*) CHOPT
CHARACTER*12  CCHOPT
+SELF, IF=QMIBM, QMIBX, QMAPO10.
DOUBLE PRECISION ISEED
+SELF, IF=QMCRY.
REAL ISEED
+SELF.
PARAMETER  (MAXSEQ=100)
DIMENSION  LSEQS(2,MAXSEQ)
COMMON / RANEC1 / JSEQ(2), ISEED(2,MAXSEQ)
SAVE /RANEC1/

go to start of document
DATA (LSEQS(J,  1),J=1,2) /      9876,     54321/
DATA (LSEQS(J,  2),J=1,2) /1058718014,1872605764/
DATA (LSEQS(J,  3),J=1,2) /1814868809, 849641138/
DATA (LSEQS(J,  4),J=1,2) /1503041326, 998515605/
DATA (LSEQS(J,  5),J=1,2) / 628142053, 244439171/
DATA (LSEQS(J,  6),J=1,2) /1391554630, 846883852/
DATA (LSEQS(J,  7),J=1,2) /1535236638, 154775958/
DATA (LSEQS(J,  8),J=1,2) /1747133713,1575487760/
DATA (LSEQS(J,  9),J=1,2) / 714962706,2107758832/
DATA (LSEQS(J, 10),J=1,2) /1486824114, 786139113/
DATA (LSEQS(J, 11),J=1,2) /1323688611, 371658774/
DATA (LSEQS(J, 12),J=1,2) /1570590541, 630312859/
DATA (LSEQS(J, 13),J=1,2) /1555058144, 358976382/
DATA (LSEQS(J, 14),J=1,2) / 952681104,1242126412/
DATA (LSEQS(J, 15),J=1,2) /1083789165,1890043487/
DATA (LSEQS(J, 16),J=1,2) / 631749547,1925864168/
DATA (LSEQS(J, 17),J=1,2) /1178945274,1475158130/
DATA (LSEQS(J, 18),J=1,2) /1009344940,1502757676/
DATA (LSEQS(J, 19),J=1,2) /1933972860,1627514572/
DATA (LSEQS(J, 20),J=1,2) /1875817978, 567972013/
DATA (LSEQS(J, 21),J=1,2) / 446320203, 273324776/
DATA (LSEQS(J, 22),J=1,2) / 460899131,1527583930/
DATA (LSEQS(J, 23),J=1,2) /  35532104, 558897732/
DATA (LSEQS(J, 24),J=1,2) /2089458455,1339622951/
DATA (LSEQS(J, 25),J=1,2) /1535926201,1918446533/
DATA (LSEQS(J, 26),J=1,2) / 669734232,1019772931/
DATA (LSEQS(J, 27),J=1,2) / 501928827, 285518477/
DATA (LSEQS(J, 28),J=1,2) / 942354467, 280177956/
DATA (LSEQS(J, 29),J=1,2) / 192461969,1576639468/
DATA (LSEQS(J, 30),J=1,2) /1601863355, 661544549/
DATA (LSEQS(J, 31),J=1,2) /1743728581, 523887323/
DATA (LSEQS(J, 32),J=1,2) /1703010089,1259731603/
DATA (LSEQS(J, 33),J=1,2) /1643511188, 875622567/
DATA (LSEQS(J, 34),J=1,2) /1755559262,2142089492/
DATA (LSEQS(J, 35),J=1,2) / 114689819, 126275958/
DATA (LSEQS(J, 36),J=1,2) / 105250298,1127134231/
DATA (LSEQS(J, 37),J=1,2) /  79402987,1236641847/
DATA (LSEQS(J, 38),J=1,2) / 387101667,1706644076/
DATA (LSEQS(J, 39),J=1,2) /1734232502, 664024463/
DATA (LSEQS(J, 40),J=1,2) /2123161160,1759230139/
DATA (LSEQS(J, 41),J=1,2) /1811169504,1405252309/
DATA (LSEQS(J, 42),J=1,2) /1766746084, 274705383/
DATA (LSEQS(J, 43),J=1,2) / 959435020, 108779126/
DATA (LSEQS(J, 44),J=1,2) /2062813302,1863432262/
DATA (LSEQS(J, 45),J=1,2) /1691639052,1503605588/
DATA (LSEQS(J, 46),J=1,2) /1086444145, 158310100/
DATA (LSEQS(J, 47),J=1,2) /2058594463, 810394383/
DATA (LSEQS(J, 48),J=1,2) /2101564568,1105108539/
DATA (LSEQS(J, 49),J=1,2) / 978826660, 617502647/
DATA (LSEQS(J, 50),J=1,2) /1436276288, 529578818/
DATA (LSEQS(J, 51),J=1,2) / 556864235, 606529730/
DATA (LSEQS(J, 52),J=1,2) /1078146847,1147358663/
DATA (LSEQS(J, 53),J=1,2) /1447193285,1376658008/
DATA (LSEQS(J, 54),J=1,2) /1006664521,1311015086/
DATA (LSEQS(J, 55),J=1,2) /1837174956, 768046385/
DATA (LSEQS(J, 56),J=1,2) / 896589370, 260492364/
DATA (LSEQS(J, 57),J=1,2) /1360218380,1414233683/
DATA (LSEQS(J, 58),J=1,2) /1278625491,1552675421/
DATA (LSEQS(J, 59),J=1,2) /1011812242,1458050027/
DATA (LSEQS(J, 60),J=1,2) /1754922946,1785085266/
DATA (LSEQS(J, 61),J=1,2) /1343566665, 443288238/
DATA (LSEQS(J, 62),J=1,2) /1437791085,2078825854/
DATA (LSEQS(J, 63),J=1,2) /2094123993,1341409348/
DATA (LSEQS(J, 64),J=1,2) /1537730690, 153906788/
DATA (LSEQS(J, 65),J=1,2) /2127544614,   4856371/
DATA (LSEQS(J, 66),J=1,2) /1004692237, 786489538/
DATA (LSEQS(J, 67),J=1,2) / 821800123,1417369188/
DATA (LSEQS(J, 68),J=1,2) / 312261859, 286397034/
DATA (LSEQS(J, 69),J=1,2) /1519811572, 144643793/
DATA (LSEQS(J, 70),J=1,2) /   5329351,1263184329/
DATA (LSEQS(J, 71),J=1,2) /1416419532,1842707225/
DATA (LSEQS(J, 72),J=1,2) /1697860185, 840465352/
DATA (LSEQS(J, 73),J=1,2) /1934192451, 619946463/
DATA (LSEQS(J, 74),J=1,2) / 170088516,1174161868/
DATA (LSEQS(J, 75),J=1,2) /1304806046, 108470534/
DATA (LSEQS(J, 76),J=1,2) /1976265015,1714480092/
DATA (LSEQS(J, 77),J=1,2) / 783664411, 978542208/
DATA (LSEQS(J, 78),J=1,2) /1694901962,  55891868/
DATA (LSEQS(J, 79),J=1,2) /1548123234, 424683817/
DATA (LSEQS(J, 80),J=1,2) /1042788941,1370039022/
DATA (LSEQS(J, 81),J=1,2) /1576822555,1268584439/
DATA (LSEQS(J, 82),J=1,2) / 831708278,1432924432/
DATA (LSEQS(J, 83),J=1,2) / 993848687, 233811113/
DATA (LSEQS(J, 84),J=1,2) / 745249148, 738800065/
DATA (LSEQS(J, 85),J=1,2) /1947731465,1336392610/
DATA (LSEQS(J, 86),J=1,2) /1402689657,1392469639/
DATA (LSEQS(J, 87),J=1,2) / 311285254,1241207984/
DATA (LSEQS(J, 88),J=1,2) /1206768222, 887510662/
DATA (LSEQS(J, 89),J=1,2) / 762376025,1967748670/
DATA (LSEQS(J, 90),J=1,2) / 923860508, 824843061/
DATA (LSEQS(J, 91),J=1,2) / 755432194,1333575913/
DATA (LSEQS(J, 92),J=1,2) / 233721957, 126133675/
DATA (LSEQS(J, 93),J=1,2) /1989717210, 691593480/
DATA (LSEQS(J, 94),J=1,2) /1030990373, 128881640/
DATA (LSEQS(J, 95),J=1,2) /1322807026, 928284400/
DATA (LSEQS(J, 96),J=1,2) /1169603884,1077182026/
DATA (LSEQS(J, 97),J=1,2) / 976273645,1973303129/
DATA (LSEQS(J, 98),J=1,2) / 530354343,1592879270/
DATA (LSEQS(J, 99),J=1,2) / 947509404, 205601315/
DATA (LSEQS(J,100),J=1,2) /1840231302,1716122836/
C

go to start of document
CCHOPT = CHOPT
IF(CCHOPT.EQ.' ') THEN
JSEQ(1)    = 1
IF(ISEQ.GT.0.AND.ISEQ.LE.MAXSEQ) JSEQ(1) = ISEQ
ISEED(1,JSEQ(1)) = LSEQS(1,JSEQ(1))
ISEED(2,JSEQ(1)) = LSEQS(2,JSEQ(1))
GO TO 999
ENDIF
IF(INDEX(CHOPT,'S').NE.0) THEN
IF(ISEQ.GT.0) JSEQ(1) = ISEQ
IF(IS1.GT.0.AND.IS2.GT.0) THEN
ISEED(1,JSEQ(1)) = IS1
ISEED(2,JSEQ(1)) = IS2
ENDIF
ENDIF

go to start of document
IF(INDEX(CHOPT,'R').NE.0) THEN
IF(ISEQ.LE.0) ISEQ = JSEQ(1)
IS1 = ISEED(1,ISEQ)
IS2 = ISEED(2,ISEQ)
JSEQ(1) = ISEQ
ENDIF
IF(INDEX(CHOPT,'Q').NE.0) THEN
IF(ISEQ.GE.0.AND.ISEQ.LE.MAXSEQ) THEN
IS1 = LSEQS(1,ISEQ)
IS2 = LSEQS(2,ISEQ)
ELSE
IS1 = 0
IS2 = 0
ENDIF
ENDIF
C
999  RETURN
END
```
go to start of document
WEHMANN@rdiv.fnal.gov