Answer the question
In order to leave comments, you need to log in
How to implement Poisson stream?
I'm trying to implement the algorithm taken from here https://life-prog.ru/1_13833_puassonovskiy-potok.html (Fig. 28.6)
I get a completely different result (1-digit number instead of 33)
My code
<?php
$lambda = 8 / 24;
$Tn = 100;
$t = 0;
$N = 0;
do {
$r = rand(0,1);
$temp = (-1 / $lambda) * log($r);
$t = $t + $temp;
$N = $N + 1;
//echo $t;
} while ($t <= $Tn);
var_dump($N);
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question