]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MINICERN/packlib/kernlib/kerngen/tcgens/dosgs/rndm.F
Bugfix in AliPoints2Memory
[u/mrichter/AliRoot.git] / MINICERN / packlib / kernlib / kerngen / tcgens / dosgs / rndm.F
CommitLineData
fe4da5cc 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)
10C
11C CERN PROGLIB# V104 RNDM .VERSION KERNDOS 1.00 920624
12C ORIG. 22-MAR-88 from IBM version of G.Marsaglia et al., Montreal
13C MODIF 24/06/92, adapted N.Karpenko, Dubna
14C
15C !!! Version valid only for 32 bit machines !!!
16C !!! with IEEE floating point representation !!!
17C
18C- Uniform Random Number Generator,
19C- giving the same sequence as the IBM and VAX version
20
21 EQUIVALENCE (AMAN,MANT)
22 PARAMETER (MSK1 = 201326592)
23 PARAMETER (MSK2 = 855638016)
24C PARAMETER (MSK1 = '0C000000'X)
25C PARAMETER (MSK2 = '33000000'X)
26 COMMON /MCGN/ MCGN
27 DATA MCGN /12345/
28
29
30 MCGN = MCGN * 69069
31 MANT = ISHFT (MCGN,-8)
32 IF (MANT.EQ.0) GO TO 14
33 AMAN = MANT
34C- AMAN in the range 1 to 2**24-1
35 MANT = MANT - MSK1
36C- multiply by 2.**(-24)
37 RNDM = AMAN
38 RETURN
39
40C-- for zero set RNDM = 2.**(-25)
41 14 MANT = MSK2
42 RNDM = AMAN
43 RETURN
44 END
45 FUNCTION IRNDM(ISEEK)
46 COMMON /MCGN/ MCGN
47
48C-- Integer random number
49 MCGN = MCGN * 69069
50 IRNDM = ISHFT (MCGN,-1)
51 RETURN
52 END
53 SUBROUTINE RDMIN(ISEED)
54 COMMON /MCGN/ MCGN
55
56C-- Set the seed
57 MCGN = ISEED
58 RETURN
59
60C-- Get the seed
61 ENTRY RDMOUT (ISEED)
62 ISEED = MCGN
63 END