(defun poisson(lamb) ;Generates a poisson distibuted ranom number with intensity lambda (let ((x (randexp 1)) (rand 0)) (while (< x lamb) (setf x (+ x (randexp 1))) (setf rand (+ rand 1)) ) rand)) (defun randexp(m) ;Generates a random number from a exponential distribution ;with expeced value m, (- (* m (log (my-random 1.)))))