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

Alex Herbert commented on STATISTICS-33:
----------------------------------------

{quote}Why not remove them altogether?
{quote}
They are used in various test classes which is why I suggested moving them to 
the TestUtils.

 

> 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
>
> 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