commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ole Ersoy (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (MATH-1124) Instances of AbstractRealDistribution require a random generator.
Date Wed, 08 Oct 2014 13:55:34 GMT

    [ https://issues.apache.org/jira/browse/MATH-1124?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14163507#comment-14163507
] 

Ole Ersoy commented on MATH-1124:
---------------------------------

I agree that writing a RandomGenerator mock is simple, but I do believe that in order to maximize
the simplicity, flexibility, and focus of the design it is best to inject both the RNG and
the distribution into a class/classes that is/are designed for sampling and things related
to sampling.

For instance there could be a minimal SamplingObserver interface:

subscribe(SampleListener)
next() //triggers 1 iteration of observing the sampling
next(int n) //triggers n iterations of observing sampling

I'm not an expert here, but I suspect that the strategy design pattern could be used to design
one instance that samples from all the distributions and that could be easily extended.

> Instances of AbstractRealDistribution require a random generator.
> -----------------------------------------------------------------
>
>                 Key: MATH-1124
>                 URL: https://issues.apache.org/jira/browse/MATH-1124
>             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
(v6.3.4#6332)

Mime
View raw message