*
* $Id$
*
* $Log$
*
*CMZ :  3.00/00 06/04/2001  11.21.19  by  Marialuigia Ambriola
*-- Author :    Marialuigia Ambriola   05/04/2001
      INTEGER FUNCTION NPOISS(X)
**************************************
* Simulate the Poisson distribution
* From data particle book vol. 15 2000
**************************************
      REAL U,A,X
      INTEGER K,N
      NPOISS=0
      K=1
      A=1.
 100  U=RNDM(1)
      A=U*A
      IF(A.LT.EXP(-X)) THEN
         N=K-1
      ELSE
         K=K+1
         GOTO 100
      ENDIF
      NPOISS=N
      RETURN
      END
