Details
-
Improvement
-
Status: Closed
-
Trivial
-
Resolution: Implemented
-
1.0
-
None
Description
The following utility methods can be removed:
abstract class AbstractDiscreteDistribution { public static int[] sample(int n, DiscreteDistribution.Sampler sampler) } abstract class AbstractContinuousDistribution { public static double[] sample(int n, ContinuousDistribution.Sampler sampler) }
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:
ContinuousDistribution d = ...; UniformRandomProvider rng = ...; int n = 1000; double[] samples = DoubleStream.stream(d.createSampler(rng)::sample) .limit(n) .toArray();