org.das2.qds.math.PoissonDistribution

PoissonDistribution generates numbers from the Poisson distribution. Adapted from stocc.cpp. 2018-08-28. Made thread safe, use in Jython scripts will be broken.

PoissonDistribution( )


poisson

poisson( double L, java.util.Random random ) → int

This function generates a random variate with the Poisson distribution. Uses inversion by chop-down method for L < 17, and ratio-of-uniforms method for L >= 17. For L < 1.E-6 numerical inaccuracy is avoided by direct calculation. For L > 2E9 too big--throws IllegalArgumentException Note this was a static method before 2018-08-28 (v2018a_8), so Jython calls should be PoissonDistribution().poisson().

Parameters

L - the real value
random - a random number source

Returns:

the integer value.

[search for examples] [view on GitHub] [view on old javadoc] [view source]