7 |
|
import java.util.*; |
8 |
|
import java.util.SplittableRandom; |
9 |
|
import java.util.concurrent.atomic.AtomicInteger; |
10 |
– |
import java.util.concurrent.atomic.AtomicLong; |
10 |
|
import java.util.concurrent.atomic.LongAdder; |
11 |
|
|
12 |
|
public class SplittableRandomTest extends JSR166TestCase { |
41 |
|
static final int MAX_INT_BOUND = (1 << 26); |
42 |
|
|
43 |
|
// max sampled long bound |
44 |
< |
static final long MAX_LONG_BOUND = (1L << 42); |
44 |
> |
static final long MAX_LONG_BOUND = (1L << 40); |
45 |
|
|
46 |
|
// Number of replications for other checks |
47 |
|
static final int REPS = |
88 |
|
* same values for nextLong. |
89 |
|
*/ |
90 |
|
public void testSeedConstructor() { |
91 |
< |
for (long seed = 2; seed < MAX_LONG_BOUND; seed += 15485863) { |
91 |
> |
for (long seed = 2; seed < MAX_LONG_BOUND; seed += 15485863) { |
92 |
|
SplittableRandom sr1 = new SplittableRandom(seed); |
93 |
|
SplittableRandom sr2 = new SplittableRandom(seed); |
94 |
|
for (int i = 0; i < REPS; ++i) |
129 |
|
/** |
130 |
|
* nextInt(non-positive) throws IllegalArgumentException |
131 |
|
*/ |
132 |
< |
public void testNextIntNonPositive() { |
132 |
> |
public void testNextIntBoundNonPositive() { |
133 |
|
SplittableRandom sr = new SplittableRandom(); |
134 |
|
Runnable[] throwingActions = { |
135 |
|
() -> sr.nextInt(-17), |
198 |
|
/** |
199 |
|
* nextLong(non-positive) throws IllegalArgumentException |
200 |
|
*/ |
201 |
< |
public void testNextLongNonPositive() { |
201 |
> |
public void testNextLongBoundNonPositive() { |
202 |
|
SplittableRandom sr = new SplittableRandom(); |
203 |
|
Runnable[] throwingActions = { |
204 |
|
() -> sr.nextLong(-17L), |
266 |
|
/** |
267 |
|
* nextDouble(non-positive) throws IllegalArgumentException |
268 |
|
*/ |
269 |
< |
public void testNextDoubleNonPositive() { |
269 |
> |
public void testNextDoubleBoundNonPositive() { |
270 |
|
SplittableRandom sr = new SplittableRandom(); |
271 |
|
Runnable[] throwingActions = { |
272 |
|
() -> sr.nextDouble(-17.0d), |