[
https://issues.apache.org/jira/browse/RNG-140?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17382058#comment-17382058
]
Alex Herbert commented on RNG-140:
----------------------------------
I've opened a PR with the initial interfaces/classes:
* LongSampler
* SharedStateLongSampler
* UniformLongSampler
The unit tests only have a single test class to test the sampler. These test
that the sampler uses either: UniformRandomProvider.nextLong(long) for a small
range; or UniformRandomProvider.nextLong() and rejects samples outside the
large range.
There did not seem to be a reason to duplicate the
DiscreteSamplerParametricTest for longs. That test asserts a sample is one of a
number of points (n), each sampled with a given probability. For example a
binomial distribution with n=10. For testing a large range of samples this is
not practical as an array cannot hold enough points for the range the sampler
can output.
An alternative is to duplicate the ContinuousSamplerParametricTest which
expects values in a range and the test requires the expected deciles of the
range. This could be adapted for the new sampler but since the sampler is
uniform the deciles are evenly spaced and the test is not much more informative
that just testing the implementations directly against a reference RNG that is
known to be uniform.
> nextLong(long lo, long hi)
> --------------------------
>
> Key: RNG-140
> URL: https://issues.apache.org/jira/browse/RNG-140
> Project: Commons RNG
> Issue Type: Wish
> Components: sampling
> Reporter: Gilles Sadowski
> Priority: Minor
> Labels: api
> Time Spent: 10m
> Remaining Estimate: 0h
>
> Replacement for functionality defined in
> [{{RandomUtils}}|https://gitbox.apache.org/repos/asf?p=commons-math.git;a=blob;f=commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/random/RandomUtils.java;h=60060e71d5bbe1d00878a1f54f8bb1ff88b65f11;hb=HEAD#l293].
--
This message was sent by Atlassian Jira
(v8.3.4#803005)