]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MINICERN/packlib/kernlib/kerngen/tcgens/mpwgs/rndm.F
Bugfix in AliPoints2Memory
[u/mrichter/AliRoot.git] / MINICERN / packlib / kernlib / kerngen / tcgens / mpwgs / rndm.F
1 *
2 * $Id$
3 *
4 * $Log$
5 * Revision 1.1.1.1  1996/02/15 17:50:24  mclareni
6 * Kernlib
7 *
8 *
9       FUNCTION RNDM (ISEED)
10 C
11 C CERN PROGLIB# V104    RNDM            .VERSION KERNMPW  1.00  891208
12 C ORIG. 22-MAR-88 from IBM version of G.Marsaglia et al., Montreal
13 C
14 C-    Uniform Random Number Generator,
15 C-    giving the same sequence as the IBM and VAX version
16  
17       EQUIVALENCE (AMAN,MANT)
18       PARAMETER    (MSK1 = 201326592)
19       PARAMETER    (MSK2 = 855638016)
20 C     PARAMETER    (MSK1 = '0C000000'X)
21 C     PARAMETER    (MSK2 = '33000000'X)
22       COMMON / V104RN / MCGN
23       DATA MCGN  /12345/
24  
25  
26       MCGN = MCGN * 69069
27       MANT = ISHFT (MCGN,-8)
28       IF (MANT.EQ.0)         GO TO 14
29       AMAN = MANT
30 C-    AMAN in the range 1 to 2**24-1
31       MANT = MANT - MSK1
32 C-    multiply by 2.**(-24)
33       RNDM = AMAN
34       RETURN
35  
36 C--   for zero set RNDM = 2.**(-25)
37    14 MANT = MSK2
38       RNDM = AMAN
39       RETURN
40  
41 C--       Integer random number
42       ENTRY IRNDM (ISEED)
43       MCGN  = MCGN * 69069
44       IRNDM = ISHFT (MCGN,-1)
45       END
46  
47       SUBROUTINE RDMIN (ISEED)
48 C--       Set the seed
49       COMMON / V104RN / MCGN
50       MCGN = ISEED
51       RETURN
52  
53 C--       Get the seed
54       ENTRY RDMOUT (ISEED)
55       ISEED = MCGN
56       END