commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Otmar Ertl (JIRA)" <>
Subject [jira] [Commented] (MATH-1124) Instances of AbstractRealDistribution require a random generator.
Date Wed, 08 Oct 2014 05:57:34 GMT


Otmar Ertl commented on MATH-1124:

It is fairly easy to write a RandomGenerator mock using AbstractRandomGenerator that returns
a predefined sequence of random numbers, if testing is your major concern. In my opinion,
your proposed interface 
sample(double[] uniformRNArray)
is much more complex than
sample(RandomGenerator rng)
More important, there are distributions for which rejection sampling is used to generate random
numbers. In this case, the number of required uniform distributed random numbers to generate
a single random number obeying the given distribution is random too (see

> Instances of AbstractRealDistribution require a random generator.
> -----------------------------------------------------------------
>                 Key: MATH-1124
>                 URL:
>             Project: Commons Math
>          Issue Type: Bug
>            Reporter: Ajo Fod
> 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 ... why
not use a global generic or simple 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. 

This message was sent by Atlassian JIRA

View raw message