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