]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MINICERN/packlib/kernlib/kerngen/tcgens/irtdgs/rndm.F
Bugfix in AliPoints2Memory
[u/mrichter/AliRoot.git] / MINICERN / packlib / kernlib / kerngen / tcgens / irtdgs / rndm.F
1 *
2 * $Id$
3 *
4 * $Log$
5 * Revision 1.1.1.1  1996/02/15 17:50:22  mclareni
6 * Kernlib
7 *
8 *
9       FUNCTION RNDM (ISEED)
10 C
11 C CERN PROGLIB# V104    RNDM            .VERSION KERNIRT  1.06  930811
12 C ORIG. 22-MAR-88 from IBM version of G.Marsaglia et al., Montreal
13 C
14 C     !!!   Version valid only for 32 bit machines   !!!
15 C     !!!   with IEEE floating point representation  !!!
16 C
17 C-    Uniform Random Number Generator,
18 C-    giving the same sequence as the IBM and VAX version
19
20       EQUIVALENCE (AMAN,MANT)
21       PARAMETER    (MSK1 =  25165824)
22       PARAMETER    (MSK2 = 855638016)
23 C     PARAMETER    (MSK1 = '0C000000'X)
24 C     PARAMETER    (MSK2 = '33000000'X)
25       SAVE  MCGN
26       DATA  MCGN  /12345/
27
28 #if !defined(CERNLIB_QISASTD)
29 #include "kerngen/q_andor.inc"
30 #include "kerngen/q_shift.inc"
31 * Ignoring t=pass
32 #endif
33
34       MCGN = MCGN * 69069
35 #if defined(CERNLIB_QISASTD)
36       MANT = ISHFT (MCGN,-8)
37 #endif
38 #if !defined(CERNLIB_QISASTD)
39       MANT = ISHFTR(MCGN, 8)
40 #endif
41       IF (MANT.EQ.0)         GO TO 14
42       AMAN = MANT
43 C-    AMAN in the range 1 to 2**24-1
44       MANT = MANT - MSK1
45 C-    multiply by 2.**(-24)
46       RNDM = AMAN
47       RETURN
48
49 C--   for zero set RNDM = 2.**(-25)
50    14 RNDM =  0.29802322387695312E-07
51
52       RETURN
53
54 C--       Integer random number
55       ENTRY IRNDM (ISEED)
56       MCGN  = MCGN * 69069
57 #if defined(CERNLIB_QISASTD)
58       IRNDM = ISHFT (MCGN,-1)
59 #endif
60 #if !defined(CERNLIB_QISASTD)
61       IRNDM = ISHFTR(MCGN, 1)
62 #endif
63       RETURN
64
65 C--       Set the seed
66       ENTRY RDMIN (ISEED)
67       MCGN = ISEED
68       RETURN
69
70 C--       Get the seed
71       ENTRY RDMOUT (ISEED)
72       ISEED = MCGN
73       END