1 |
* |
2 |
* $Id$ |
3 |
* |
4 |
* $Log$ |
5 |
* |
6 |
*CMZ : 3.00/00 06/04/2001 11.21.19 by Marialuigia Ambriola |
7 |
*-- Author : Marialuigia Ambriola 05/04/2001 |
8 |
INTEGER FUNCTION NPOISS(X) |
9 |
************************************** |
10 |
* Simulate the Poisson distribution |
11 |
* From data particle book vol. 15 2000 |
12 |
************************************** |
13 |
REAL U,A,X |
14 |
INTEGER K,N |
15 |
NPOISS=0 |
16 |
K=1 |
17 |
A=1. |
18 |
100 U=RNDM(1) |
19 |
A=U*A |
20 |
IF(A.LT.EXP(-X)) THEN |
21 |
N=K-1 |
22 |
ELSE |
23 |
K=K+1 |
24 |
GOTO 100 |
25 |
ENDIF |
26 |
NPOISS=N |
27 |
RETURN |
28 |
END |