commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gilles (Commented) (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (MATH-764) New sample() API should accept RandomGenerator as parameter
Date Wed, 07 Mar 2012 13:24:58 GMT

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

Gilles commented on MATH-764:
-----------------------------

* In the current design, the specific distribution subclasses would need to implement both
"RealDistribution" and "Sampler".
Can you give an example of a class that would implement "Sampler" interface?
* The addition of the "sample" methods in the distribution classes were accepted, as syntactic
sugar, on the premisses that users should be satisfied with the default RNG.
* As much as possible, we try to have immutable objects; in this view, creating (reinitializing)
the RNG after construction is not an option.
* If you need to access (or change) the RNG, the original methods designed to offer sequences
of pseudo-random numbers (with certain properties) are located in package "random" (in class
"RandomDataImpl").

                
> New sample() API should accept RandomGenerator as parameter
> -----------------------------------------------------------
>
>                 Key: MATH-764
>                 URL: https://issues.apache.org/jira/browse/MATH-764
>             Project: Commons Math
>          Issue Type: Improvement
>    Affects Versions: 3.0
>            Reporter: Alex Bertram
>   Original Estimate: 48h
>  Remaining Estimate: 48h
>
> This may come to late as I know the 3.0 release is nearing completion, but I had some
concerns about the new sample() method on the math3 RealDistribution interface. 
> Specifically, there doesn't seem to be a way to supply a random generator to the sampler.
Perhaps it would be better to have a factory method on the RealDistribution interface that
accepted a RandomGenerator and returns an instance of some new interface, Sampler, which contains
the sample() methods. 
> That is:
> interface RealDistribution {
>     Sampler createSampler(RandomGenerator generator);
>     Sample createSampler(); // uses default RandomGenerator
> }
> interface Sampler {
>     double sample();
>     double[] sample(int sampleSize);
> }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message