Hi,
I’m trying to use PoissonD from TRandom. I noticed that it is generating integer numbers instead of doubles as indicated in the manual. I’m using root_v3.10 and here is the simple code I used. Can anyone explain to me if I’m doing any mistake?
{
for (int i = 0; i < 100; ++i){
double value = gRandom->PoissonD(4.2);
cout << value << endl;
}
}
and this is what you expect from a Poisson distribution.
The PoissonD was requested by users calling the function with
very large arguments that do not fit in an integer, but in this case
it is equivalent to gaus.
Actually, I think the current implementation is worse than what you would expect. Currently,
If you pass in a mean <= 88, you will get an int that is cast to a double
If you pass in a mean > 88, you will get a double that is not an int.
I understand that at some point, it makes more sense to use a Gaussian random number generator than the Poisson random number generator, but the switch should be transparent to the user (i.e. it should always return ints cast to doubles instead of just sometimes)
Hi,
The Poisson generation of random numbers has been completely re-written since many years. Note than now a Gaussian approximation is used only for value of mean larger than 1.E9.