Skip to content

Commit f4213d5

Browse files
committed
oops...
1 parent 7e61fb8 commit f4213d5

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/main/java/de/tilman_neumann/jml/random/Random64.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@
1313
*/
1414
package de.tilman_neumann.jml.random;
1515

16-
import static org.junit.Assert.assertTrue;
17-
1816
import java.util.Random;
1917

18+
import de.tilman_neumann.util.Ensure;
19+
2020
/**
2121
* 64 bit random number generator using Random.nextLong() and the strategy from Java17 for Random.nextLong(long maxValue).
2222
*/
23-
public abstract class Random64 {
23+
public class Random64 {
2424

2525
private static final boolean DEBUG = false;
2626

@@ -58,10 +58,10 @@ public long nextLong(long maxValue) {
5858
while (true) {
5959
r = u % maxValue; // now 0 <= r <= u and r < maxValue
6060
if (DEBUG) {
61-
assertTrue(u >= 0);
62-
assertTrue(r >= 0);
63-
assertTrue(r <= u);
64-
assertTrue(r < maxValue);
61+
Ensure.ensureGreaterEquals(u, 0L);
62+
Ensure.ensureGreaterEquals(r, 0);
63+
Ensure.ensureSmallerEquals(r, u);
64+
Ensure.ensureSmaller(r, maxValue);
6565
}
6666
// Using the modulus r = u % maxValue to obtain random numbers < maxValue has its caveats...
6767
// If u is close to 2^63, then r much smaller than maxValue are over-represented.

0 commit comments

Comments
 (0)