commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Phil Steitz <>
Subject Re: [Math] Speedup opportunity in AbstractRealDistribution
Date Tue, 20 May 2014 20:15:42 GMT
On 5/20/14, 12:54 PM, Ajo Fod wrote:
> A couple of observations:
> ... The default random generator takes a while to instantiate.
> ... Many functions of these distributions don't require a random generator.
> Generally speaking only sampling requires it.
> So, why force the default constructor to initialize with a new random
> generator.

This will be removed from AbstractRealDistribution in 4.0 once the
deprecated protected (so can't be removed until then) randomData
member is removed.
>  Why not instead:
> ... use a global one
> ... a simpler default generator?
> ... Or do away with random generator except for sampling?
> This issue was observed with the TDistribution class , but it is probably
> applicable to many classes as well.

The subclasses will still need to either provide RandomGenerator
instances to constructors or use the default.  Passing null should
work to avoid the overhead you are referring to but will of course
cause NPE if you try to sample.  Lazy initialization or static
default instances are not likely to be supported.

> Cheers,
> Ajo

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message