]> git.uio.no Git - u/mrichter/AliRoot.git/blob - GEANT321/fluka/kpois.F
Default compile option changed to -g (Alpha)
[u/mrichter/AliRoot.git] / GEANT321 / fluka / kpois.F
1 *
2 * $Id$
3 *
4 * $Log$
5 * Revision 1.1.1.1  1995/10/24 10:20:01  cernlib
6 * Geant
7 *
8 *
9 #include "geant321/pilot.h"
10 *CMZ :  3.21/02 29/03/94  15.41.44  by  S.Giani
11 *-- Author :
12 *$ CREATE KPOIS.FOR
13 *COPY KPOIS
14 *
15 *=== kpois ============================================================*
16 *
17       FUNCTION KPOIS(EXPLAM)
18  
19 #include "geant321/dblprc.inc"
20 #include "geant321/dimpar.inc"
21 #include "geant321/iounit.inc"
22       REAL RNDM(1)
23 C*** EXPLAM IS EXP(-LAMBDA)
24 C*** SQMPLING FROM POISSON DISTRIBUTION, AVERAGE LAMBDA
25 C*** PK = EXP(-LAMBDA)*LAMBDA**K/(K-FACTORIAL)
26       Y=1.D0
27       KPOISS=0
28 5     CONTINUE
29       CALL GRNDM(RNDM,1)
30       Y=Y*RNDM(1)
31       IF (Y.LT.EXPLAM) GO TO 10
32       KPOISS=KPOISS+1
33       GO TO 5
34 10    CONTINUE
35       KPOIS=KPOISS
36       RETURN
37       END