add jetCheck.Generator.integers(jetCheck.IntDistribution)

This commit is contained in:
peter
2017-12-02 11:12:00 +01:00
parent 409da53e9f
commit 39ae01fef5
+6 -2
View File
@@ -227,9 +227,13 @@ public class Generator<T> {
return integers(0, Integer.MAX_VALUE);
}
/** Generates integers in the given range (both ends inclusive) */
/** Generates integers uniformly distributed in the given range (both ends inclusive) */
public static Generator<Integer> integers(int min, int max) {
IntDistribution distribution = IntDistribution.uniform(min, max);
return integers(IntDistribution.uniform(min, max));
}
/** Generates integers with the given distribution */
public static Generator<Integer> integers(@NotNull IntDistribution distribution) {
return from(data -> data.drawInt(distribution));
}