******************************************************************* subroutine raninit * * initialize random number seed * * last modified on: 22/10/03 by: R. Holzmann ******************************************************************* implicit none #include "geant321/gcflag.inc" #include "slate.inc" INTEGER IT, ID, IXD, IXDUM, I_SEED1, I_SEED2, IOSTAT, ISTAT REAL T, TIME, XDUMMY, XDUM, RN32 * KERNLIB routine datime returns decimal Integer date and time: * ID=yymmdd, IT=hhmm. It stores the components into the common block * /SLATE/: ISL(5)=mm, ISL(6)=ss * Attention: Machine dependent. if (nrndm(1).ne.0 .and. nrndm(2).ne.0) goto 10 ! use seed from RNDM key call datime(id,it) xdum = isl(6) ixd = xdum*100 if((ixd/2)*2.ne.ixd) ixd = ixd + 1 xdum = rn32(ixd) xdum = xdum*86400 time = isl(5) time = time*1000 c i_seed2 = abs(sind(time)*10000000) ! intrinsic sind is not standard i_seed2 = abs(sin(0.0174533*time)*10000000) call datime(id, it) * timex returns the execution time used by the job so far (T is the * central processor time in seconds. call timex(t) i_seed1 = 10000 * it + id + 1000. * t if((i_seed1/2)*2 .eq. i_seed1) i_seed1 = i_seed1 + 1 if((i_seed2/2)*2 .eq. i_seed2) i_seed2 = i_seed2 + 1 * nrndm is the initial seed for the random number generator; * it is defined in gcflag.inc nrndm(1) = i_seed1 nrndm(2) = i_seed2 10 call grndmq(nrndm(1),nrndm(2),1,'S') ! init generator with seed write(*,*) C--------------------------------------------------------------- C random number initialization check: call grndm(xdummy,1) print *,' ' print *,' *** initial random number:' print *,' nrndm(1) = ',nrndm(1),' nrndm(2) = ',nrndm(2) print *,' first number =',xdummy print *,' ' C -------------------------------------------------------------- return end