]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PHOS/shaker/rndm.f
This commit was generated by cvs2svn to compensate for changes in r2,
[u/mrichter/AliRoot.git] / PHOS / shaker / rndm.f
1       FUNCTION RNDM (ISEED)
2 C
3 C CERN PROGLIB# V104    RNDM            .VERSION KERNALI  1.00  900919
4 C ORIG.  2/02/89  M.K.Storr from IBM version
5 C
6 C-    Uniform Random Number Generator,
7 C-    giving the same sequence as the IBM and VAX version
8  
9       REAL         IRNDM
10       EQUIVALENCE (AMAN,MANT)
11       SAVE  MCGN
12       DATA  MCGN  /12345/
13       DATA MASK1  /'0C000000'x/, MASK2/'33000000'x/
14  
15       MCGN = MCGN * 69069
16       MANT = ishft (MCGN,-8)
17       IF (MANT.EQ.0)         GO TO 14
18       AMAN = MANT
19 C-    AMAN in the range 1 to 2**24-1
20       MANT = MANT - MASK1
21 C-    multiply by 2.**(-24)
22       RNDM = AMAN
23       RETURN
24  
25 C--   for zero set RNDM = 2.**(-25)
26    14 MANT = MASK2
27       RNDM = AMAN
28       RETURN
29  
30 C--       Integer random number
31       ENTRY IRNDM (ISEED)
32       MCGN = MCGN * 69069
33       MANT = ISHFT (MCGN,-1)
34       IRNDM = AMAN
35       RETURN
36  
37 C--       Set the seed
38       ENTRY RDMIN (ISEED)
39       MCGN = ISEED
40       RETURN
41  
42 C--       Get the seed
43       ENTRY RDMOUT (ISEED)
44       ISEED = MCGN
45       END
46