3 |
|
* Expert Group and released to the public domain, as explained at |
4 |
|
* http://creativecommons.org/publicdomain/zero/1.0/ |
5 |
|
*/ |
6 |
< |
import junit.framework.*; |
7 |
< |
import java.util.*; |
6 |
> |
|
7 |
|
import java.util.SplittableRandom; |
8 |
|
import java.util.concurrent.atomic.AtomicInteger; |
10 |
– |
import java.util.concurrent.atomic.AtomicLong; |
9 |
|
import java.util.concurrent.atomic.LongAdder; |
10 |
|
|
11 |
+ |
import junit.framework.Test; |
12 |
+ |
import junit.framework.TestSuite; |
13 |
+ |
|
14 |
|
public class SplittableRandomTest extends JSR166TestCase { |
15 |
|
|
16 |
|
public static void main(String[] args) { |
43 |
|
static final int MAX_INT_BOUND = (1 << 26); |
44 |
|
|
45 |
|
// max sampled long bound |
46 |
< |
static final long MAX_LONG_BOUND = (1L << 42); |
46 |
> |
static final long MAX_LONG_BOUND = (1L << 40); |
47 |
|
|
48 |
|
// Number of replications for other checks |
49 |
|
static final int REPS = |
90 |
|
* same values for nextLong. |
91 |
|
*/ |
92 |
|
public void testSeedConstructor() { |
93 |
< |
for (long seed = 2; seed < MAX_LONG_BOUND; seed += 15485863) { |
93 |
> |
for (long seed = 2; seed < MAX_LONG_BOUND; seed += 15485863) { |
94 |
|
SplittableRandom sr1 = new SplittableRandom(seed); |
95 |
|
SplittableRandom sr2 = new SplittableRandom(seed); |
96 |
|
for (int i = 0; i < REPS; ++i) |
131 |
|
/** |
132 |
|
* nextInt(non-positive) throws IllegalArgumentException |
133 |
|
*/ |
134 |
< |
public void testNextIntNonPositive() { |
134 |
> |
public void testNextIntBoundNonPositive() { |
135 |
|
SplittableRandom sr = new SplittableRandom(); |
136 |
|
Runnable[] throwingActions = { |
137 |
|
() -> sr.nextInt(-17), |
200 |
|
/** |
201 |
|
* nextLong(non-positive) throws IllegalArgumentException |
202 |
|
*/ |
203 |
< |
public void testNextLongNonPositive() { |
203 |
> |
public void testNextLongBoundNonPositive() { |
204 |
|
SplittableRandom sr = new SplittableRandom(); |
205 |
|
Runnable[] throwingActions = { |
206 |
|
() -> sr.nextLong(-17L), |
268 |
|
/** |
269 |
|
* nextDouble(non-positive) throws IllegalArgumentException |
270 |
|
*/ |
271 |
< |
public void testNextDoubleNonPositive() { |
271 |
> |
public void testNextDoubleBoundNonPositive() { |
272 |
|
SplittableRandom sr = new SplittableRandom(); |
273 |
|
Runnable[] throwingActions = { |
274 |
|
() -> sr.nextDouble(-17.0d), |