5 * Revision 1.2 1998/03/02 15:33:35 japost
6 * A significant error on Linux is corrected:
8 * Two lines of grndm were not defined for any system that was not listed.
9 * In such a system (and Linux was one) the behavior of grndm was incorrect.
11 * A default behavior is now defined for all systems. Any system that has
12 * a problem with this behavior (using integer division) must be added to
13 * the #ifdef together with IBMALL etc.
15 * Revision 1.1.1.1 1995/10/24 10:21:42 cernlib
19 #include "geant321/pilot.h"
20 *CMZ : 3.21/02 29/03/94 15.41.23 by S.Giani
22 SUBROUTINE GRNDM(RVEC,LEN)
24 C. ******************************************************************
26 C. * To generate a vector RVECV of LEN random numbers *
27 C. * Copy of the CERN Library routine RANECU *
29 C. * ==>Called by : <USER>, many GEANT routines *
30 C. * Author F.Carminati ********* *
32 C. ******************************************************************
34 #if defined(CERNLIB_CRAY)
38 #if defined(CERNLIB_CRAY)
39 REAL ISEED, ISEED1, ISEED2, K, C1, C2, IZ
41 #if defined(CERNLIB_IBMALL)||defined(CERNLIB_IBMRT)||defined(CERNLIB_APO10K)||defined(CERNLIB_HPUX)||defined(CERNLIB_MSDOS)||defined(CERNLIB_WINNT)
42 DOUBLE PRECISION ISEED, ISEED1, ISEED2, K, C1, C2, IZ
44 #if defined(CERNLIB_IBMALL)||defined(CERNLIB_IBMRT)||defined(CERNLIB_CRAY)||defined(CERNLIB_APO10K)||defined(CERNLIB_HPUX)||defined(CERNLIB_MSDOS)||defined(CERNLIB_WINNT)
45 PARAMETER (C1=1./53668.,C2=1./52774.)
47 PARAMETER (MAXSEQ=215)
48 COMMON / GCRNDM / JSEQ(2), ISEED(2,MAXSEQ)
51 ISEED1 = ISEED(1,ISEQ)
52 ISEED2 = ISEED(2,ISEQ)
54 #if defined(CERNLIB_IBMALL)||defined(CERNLIB_IBMRT)||defined(CERNLIB_CRAY)||defined(CERNLIB_APO10K)||defined(CERNLIB_HPUX)||defined(CERNLIB_MSDOS)||defined(CERNLIB_WINNT)
59 ISEED1 = 40014*(ISEED1 - K*53668) - K*12211
60 IF (ISEED1 .LT. 0) ISEED1=ISEED1+2147483563
62 #if defined(CERNLIB_IBMALL)||defined(CERNLIB_IBMRT)||defined(CERNLIB_CRAY)||defined(CERNLIB_APO10K)||defined(CERNLIB_HPUX)||defined(CERNLIB_MSDOS)||defined(CERNLIB_WINNT)
67 ISEED2 = 40692*(ISEED2 - K*52774) - K* 3791
68 IF (ISEED2 .LT. 0) ISEED2=ISEED2+2147483399
71 IF (IZ .LE. 0) IZ = IZ + 2147483562
73 RVEC(I) = IZ * 4.6566128E-10
75 ISEED(1,ISEQ) = ISEED1
76 ISEED(2,ISEQ) = ISEED2