[ 
https://issues.apache.org/jira/browse/STATISTICS-33?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Alex Herbert resolved STATISTICS-33.
------------------------------------
    Fix Version/s: 1.0
       Resolution: Implemented

Moved in commit:

989fecb9bd871b24e74067b4d7ccbf9b68f8fa10

> Remove the utility function to create an array of samples from a Sampler
> ------------------------------------------------------------------------
>
>                 Key: STATISTICS-33
>                 URL: https://issues.apache.org/jira/browse/STATISTICS-33
>             Project: Apache Commons Statistics
>          Issue Type: Improvement
>          Components: distribution
>    Affects Versions: 1.0
>            Reporter: Alex Herbert
>            Priority: Trivial
>             Fix For: 1.0
>
>
> The following utility methods can be removed:
> {code:java}
> abstract class AbstractDiscreteDistribution {
>     public static int[] sample(int n,
>                                DiscreteDistribution.Sampler sampler)
> }
> abstract class AbstractContinuousDistribution {
>     public static double[] sample(int n,
>                                   ContinuousDistribution.Sampler sampler)
> }
> {code}
> They exists as utility methods in a package-private abstract class (thus the 
> public modifier is confusing). I suggest moving them to TestUtils. They can 
> be replicated in code by using a stream:
> {code:java}
> ContinuousDistribution d = ...;
> UniformRandomProvider rng = ...;
> int n = 1000;
> double[] samples = DoubleStream.stream(d.createSampler(rng)::sample)
>                                .limit(n)
>                                .toArray();
> {code}
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to