[
https://issues.apache.org/jira/browse/MATH-764?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13285630#comment-13285630
]
Gilles commented on MATH-764:
-----------------------------
bq. [...] have a separate set of interfaces/classes that sample from
distributions: e.g. InversionSampler which would accept a Distribution and
RandomData arguments to the constructor. [...]
Given the separation between the "...Distribution" classes and the sampling
functionality located in "RandomData", if we want to keep this "historical"
design (not my preferred option, but others will veto a merge), I also think
that a new "SamplerFactory" would be the best approach. However I'm not sure
that it would currently have enough "handles" into the internals of the
Distribution implementations in order to provide the required functionality.
Anyway, best to talk with some code in had, so let's wait for your patch...
> 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
> Attachments: sampler-refactor.diff
>
> 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