Class SamplingUtils
java.lang.Object
dk.jonaslindstrom.ruffini.common.util.SamplingUtils
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic List<BigInteger>
generateDecreasingSequence
(BigInteger n, Random random) Generate a decreasing list of numbers s_0, s_1, ..., s_k such that s_0 \leq n and s_k = 1.static BigInteger
sample
(BigInteger n, Random random) Sample a random BigInteger in the range [0,n)static Optional<Pair<BigInteger,
List<BigInteger>>> sampleFactoredNumber
(BigInteger upperBound, Random random) static BigInteger
sampleInclusive
(BigInteger n, Random random) Sample a random BigInteger in the range [0,n]
-
Constructor Details
-
SamplingUtils
public SamplingUtils()
-
-
Method Details
-
sample
Sample a random BigInteger in the range [0,n) -
sampleFactoredNumber
public static Optional<Pair<BigInteger,List<BigInteger>>> sampleFactoredNumber(BigInteger upperBound, Random random) -
sampleInclusive
Sample a random BigInteger in the range [0,n] -
generateDecreasingSequence
Generate a decreasing list of numbers s_0, s_1, ..., s_k such that s_0 \leq n and s_k = 1.
-