5 |
|
*/ |
6 |
|
|
7 |
|
import java.util.Arrays; |
8 |
– |
import java.util.ArrayList; |
8 |
|
import java.util.List; |
9 |
|
import java.util.SplittableRandom; |
10 |
|
import java.util.concurrent.atomic.AtomicInteger; |
561 |
|
*/ |
562 |
|
public void testNextBytes() { |
563 |
|
SplittableRandom sr = new SplittableRandom(); |
564 |
< |
int n = sr.nextInt(20); |
564 |
> |
int n = sr.nextInt(1, 20); |
565 |
|
byte[] bytes = new byte[n]; |
566 |
|
outer: |
567 |
|
for (int i = 0; i < n; i++) { |
576 |
|
} |
577 |
|
} |
578 |
|
|
579 |
+ |
/** |
580 |
+ |
* Filling an empty array with random bytes succeeds without effect. |
581 |
+ |
*/ |
582 |
+ |
public void testNextBytes_emptyArray() { |
583 |
+ |
new SplittableRandom().nextBytes(new byte[0]); |
584 |
+ |
} |
585 |
+ |
|
586 |
+ |
public void testNextBytes_nullArray() { |
587 |
+ |
try { |
588 |
+ |
new SplittableRandom().nextBytes(null); |
589 |
+ |
shouldThrow(); |
590 |
+ |
} catch (NullPointerException success) {} |
591 |
+ |
} |
592 |
+ |
|
593 |
|
} |