TRandom vs. TRandom2 vs TRandom3 (and Poisson problems)


I just ran into this very interesting note from Joel Heinrich on “TRandom Pitfalls”: … tfalls.pdf

I was wondering if there is any relevant discussion (or talk, or documentation) here that is commenting on this.



The point about TRandom3 vs TRandom is well known, the one about Poisson less. For Poisson, I thought that I started from Numerical recipees
and not from cernlib.
Our intention is to rename TRandom TRandom0
and typedef TRandom to TRandom3 (or something along these lines).
for Poisson, it would be straigthforward to replace the algorithm
by anything better.


Ok Rene, thanks for letting me know.

Of course, when you say that the story about “TRandom3 vs TRandom is well known”, it does not necessarily mean that the thousands of users that use TRandom (including myself) are well informed and responsible customers. :slight_smile:

Thanks, Christos, for posting my
CDF/statistics note to root talk.

With respect to the Poisson problem, I have
attached a version of the code I use to
test prospective Poisson generators.
TRandom3::Poisson passes with mu=87.999,
but fails when 88.001, as shown in the
attached log files.

The Numerical Recipes Poisson generator does
pass the test.

Charles Plager has pointed out to me an additional
small problem, related to TRandom::PoissonD.
When it uses the Gaussian approximation,
it neglects converting to integer. It needs something like “floor(x+0.5)”.
bad.txt (3.64 KB)
good.txt (3.64 KB)
poisson_gen_test_TR.cpp (1.47 KB)