]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TEvtGen/PHOTOS/phoran.F
AliDecayer realisation for the EvtGen code and EvtGen itself.
[u/mrichter/AliRoot.git] / TEvtGen / PHOTOS / phoran.F
1       FUNCTION PHORAN(IDUM)
2 C.----------------------------------------------------------------------
3 C.
4 C.    PHOTOS:   PHOton radiation in decays RANdom number generator based
5 C.              on Marsaglia Algorithm
6 C.
7 C.    Purpose:  Generate  uniformly  distributed  random numbers between
8 C.              0 and 1.  Super long period:  2**144.  See also:
9 C.              G. Marsaglia and A. Zaman,  FSU-SCR-87-50,  for seed mo-
10 C.              difications  to  this version  see:  F. James DD-Report,
11 C.              November 1988.  The generator  has  to be initialized by
12 C.              a call to PHORIN.
13 C.
14 C.    Input Parameters:   IDUM (integer dummy)
15 C.
16 C.    Output Parameters:  Function value
17 C.
18 C.    Author(s):  B. van Eijk, G. Marsaglia and   Created at:  27/09/89
19 C.                A. Zaman                        Last Update: 27/09/89
20 C.
21 C.----------------------------------------------------------------------
22       IMPLICIT NONE
23       REAL*8 PHORAN
24       INTEGER IDUM
25       INTEGER ISEED,I97,J97
26       REAL*8 URAN,CRAN,CDRAN,CMRAN
27       COMMON/PHSEED/ISEED(2),I97,J97,URAN(97),CRAN,CDRAN,CMRAN
28    10 PHORAN=URAN(I97)-URAN(J97)
29       IF (PHORAN.LT.0.D0) PHORAN=PHORAN+1.D0
30       URAN(I97)=PHORAN
31       I97=I97-1
32       IF (I97.EQ.0) I97=97
33       J97=J97-1
34       IF (J97.EQ.0) J97=97
35       CRAN=CRAN-CDRAN
36       IF (CRAN.LT.0.D0) CRAN=CRAN+CMRAN
37       PHORAN=PHORAN-CRAN
38       IF (PHORAN.LT.0.D0) PHORAN=PHORAN+1.D0
39       IF (PHORAN.LE.0.D0) GOTO 10
40       RETURN
41       END