]>
Commit | Line | Data |
---|---|---|
fe4da5cc | 1 | * |
2 | * $Id$ | |
3 | * | |
4 | * $Log$ | |
5 | * Revision 1.3 1997/10/23 16:37:04 mclareni | |
6 | * NT mods | |
7 | * | |
8 | * Revision 1.2 1997/02/04 17:36:24 mclareni | |
9 | * Merge Winnt and 97a versions | |
10 | * | |
11 | * Revision 1.1.1.1.2.1 1997/01/21 11:31:40 mclareni | |
12 | * All mods for Winnt 96a on winnt branch | |
13 | * | |
14 | * Revision 1.1.1.1 1996/02/15 17:50:13 mclareni | |
15 | * Kernlib | |
16 | * | |
17 | * | |
18 | #include "kerngen/pilot.h" | |
19 | #if defined(CERNLIB_MSSTDCALL)&&defined(CERNLIB_WINNT) | |
20 | #include "wntgs/rndm.F" | |
21 | #elif defined(CERNLIB_QMDOS) | |
22 | #include "dosgs/rndm.F" | |
23 | #elif defined(CERNLIB_QMMPW) | |
24 | #include "mpwgs/rndm.F" | |
25 | #elif defined(CERNLIB_QMVAOS)||defined(CERNLIB_QMVMI) | |
26 | #include "allgs/rndm.F" | |
27 | #elif defined(CERNLIB_QMLNX) | |
28 | #include "lnxgs/rndm.F" | |
29 | #elif defined(CERNLIB_QMIRTD) | |
30 | #include "irtdgs/rndm.F" | |
31 | #elif defined(CERNLIB_QMSUN) | |
32 | #include "sungs/rndm.F" | |
33 | #elif defined(CERNLIB_QMVAX) | |
34 | #include "vaxgs/rndm.F" | |
35 | #elif (defined(CERNLIB_B32))&&(defined(CERNLIB_QIEEE)) | |
36 | FUNCTION RNDM (ISEED) | |
37 | C | |
38 | C CERN PROGLIB# V104 RNDM .VERSION KERNFOR 4.23 891215 | |
39 | C ORIG. 22-MAR-88 from IBM version of G.Marsaglia et al., Montreal | |
40 | C | |
41 | C !!! Version valid only for 32 bit machines !!! | |
42 | C !!! with IEEE floating point representation !!! | |
43 | C | |
44 | C- Uniform Random Number Generator, | |
45 | C- giving the same sequence as the IBM and VAX version | |
46 | ||
47 | EQUIVALENCE (AMAN,MANT) | |
48 | PARAMETER (MSK1 = 201326592) | |
49 | PARAMETER (MSK2 = 855638016) | |
50 | C PARAMETER (MSK1 = '0C000000'X) | |
51 | C PARAMETER (MSK2 = '33000000'X) | |
52 | SAVE MCGN | |
53 | DATA MCGN /12345/ | |
54 | ||
55 | #if !defined(CERNLIB_QISASTD) | |
56 | #include "kerngen/q_andor.inc" | |
57 | #include "kerngen/q_shift.inc" | |
58 | * Ignoring t=pass | |
59 | #endif | |
60 | ||
61 | MCGN = MCGN * 69069 | |
62 | #if defined(CERNLIB_QISASTD) | |
63 | MANT = ISHFT (MCGN,-8) | |
64 | #endif | |
65 | #if !defined(CERNLIB_QISASTD) | |
66 | MANT = ISHFTR(MCGN, 8) | |
67 | #endif | |
68 | IF (MANT.EQ.0) GO TO 14 | |
69 | AMAN = MANT | |
70 | C- AMAN in the range 1 to 2**24-1 | |
71 | MANT = MANT - MSK1 | |
72 | C- multiply by 2.**(-24) | |
73 | RNDM = AMAN | |
74 | RETURN | |
75 | ||
76 | C-- for zero set RNDM = 2.**(-25) | |
77 | 14 MANT = MSK2 | |
78 | RNDM = AMAN | |
79 | RETURN | |
80 | ||
81 | C-- Integer random number | |
82 | ENTRY IRNDM (ISEED) | |
83 | MCGN = MCGN * 69069 | |
84 | #if defined(CERNLIB_QISASTD) | |
85 | IRNDM = ISHFT (MCGN,-1) | |
86 | #endif | |
87 | #if !defined(CERNLIB_QISASTD) | |
88 | IRNDM = ISHFTR(MCGN, 1) | |
89 | #endif | |
90 | RETURN | |
91 | ||
92 | C-- Set the seed | |
93 | ENTRY RDMIN (ISEED) | |
94 | MCGN = ISEED | |
95 | RETURN | |
96 | ||
97 | C-- Get the seed | |
98 | ENTRY RDMOUT (ISEED) | |
99 | ISEED = MCGN | |
100 | END | |
101 | #endif |