41 |
|
* generate subtasks. Class SplittableRandom supports methods for |
42 |
|
* producing pseudorandom numbers of type {@code int}, {@code long}, |
43 |
|
* and {@code double} with similar usages as for class |
44 |
< |
* {@link java.util.Random} but differs in the following ways: <ul> |
44 |
> |
* {@link java.util.Random} but differs in the following ways: |
45 |
> |
* |
46 |
> |
* <ul> |
47 |
|
* |
48 |
|
* <li>Series of generated values pass the DieHarder suite testing |
49 |
|
* independence and uniformity properties of random number generators. |
455 |
|
* @param bound the bound on the random number to be returned. Must be |
456 |
|
* positive. |
457 |
|
* @return a pseudorandom {@code int} value between zero |
458 |
< |
* (inclusive) and the bound (exclusive). |
458 |
> |
* (inclusive) and the bound (exclusive) |
459 |
|
* @throws IllegalArgumentException if the bound is less than zero |
460 |
|
*/ |
461 |
|
public int nextInt(int bound) { |
482 |
|
* @param origin the least value returned |
483 |
|
* @param bound the upper bound (exclusive) |
484 |
|
* @return a pseudorandom {@code int} value between the origin |
485 |
< |
* (inclusive) and the bound (exclusive). |
485 |
> |
* (inclusive) and the bound (exclusive) |
486 |
|
* @throws IllegalArgumentException if {@code origin} is greater than |
487 |
|
* or equal to {@code bound} |
488 |
|
*/ |
508 |
|
* @param bound the bound on the random number to be returned. Must be |
509 |
|
* positive. |
510 |
|
* @return a pseudorandom {@code long} value between zero |
511 |
< |
* (inclusive) and the bound (exclusive). |
511 |
> |
* (inclusive) and the bound (exclusive) |
512 |
|
* @throws IllegalArgumentException if {@code bound} is less than zero |
513 |
|
*/ |
514 |
|
public long nextLong(long bound) { |
535 |
|
* @param origin the least value returned |
536 |
|
* @param bound the upper bound (exclusive) |
537 |
|
* @return a pseudorandom {@code long} value between the origin |
538 |
< |
* (inclusive) and the bound (exclusive). |
538 |
> |
* (inclusive) and the bound (exclusive) |
539 |
|
* @throws IllegalArgumentException if {@code origin} is greater than |
540 |
|
* or equal to {@code bound} |
541 |
|
*/ |
563 |
|
* @param bound the bound on the random number to be returned. Must be |
564 |
|
* positive. |
565 |
|
* @return a pseudorandom {@code double} value between zero |
566 |
< |
* (inclusive) and the bound (exclusive). |
566 |
> |
* (inclusive) and the bound (exclusive) |
567 |
|
* @throws IllegalArgumentException if {@code bound} is less than zero |
568 |
|
*/ |
569 |
|
public double nextDouble(double bound) { |
581 |
|
* @param origin the least value returned |
582 |
|
* @param bound the upper bound |
583 |
|
* @return a pseudorandom {@code double} value between the origin |
584 |
< |
* (inclusive) and the bound (exclusive). |
584 |
> |
* (inclusive) and the bound (exclusive) |
585 |
|
* @throws IllegalArgumentException if {@code origin} is greater than |
586 |
|
* or equal to {@code bound} |
587 |
|
*/ |
614 |
|
|
615 |
|
/** |
616 |
|
* Returns an effectively unlimited stream of pseudorandom {@code int} |
617 |
< |
* values |
617 |
> |
* values. |
618 |
|
* |
619 |
|
* @implNote This method is implemented to be equivalent to {@code |
620 |
|
* ints(Long.MAX_VALUE)}. |
637 |
|
* @param randomNumberOrigin the origin of each random value |
638 |
|
* @param randomNumberBound the bound of each random value |
639 |
|
* @return a stream of pseudorandom {@code int} values, |
640 |
< |
* each with the given origin and bound. |
640 |
> |
* each with the given origin and bound |
641 |
|
* @throws IllegalArgumentException if {@code streamSize} is |
642 |
|
* less than zero, or {@code randomNumberOrigin} |
643 |
|
* is greater than or equal to {@code randomNumberBound} |
664 |
|
* @param randomNumberOrigin the origin of each random value |
665 |
|
* @param randomNumberBound the bound of each random value |
666 |
|
* @return a stream of pseudorandom {@code int} values, |
667 |
< |
* each with the given origin and bound. |
667 |
> |
* each with the given origin and bound |
668 |
|
* @throws IllegalArgumentException if {@code randomNumberOrigin} |
669 |
|
* is greater than or equal to {@code randomNumberBound} |
670 |
|
*/ |
720 |
|
* @param randomNumberOrigin the origin of each random value |
721 |
|
* @param randomNumberBound the bound of each random value |
722 |
|
* @return a stream of pseudorandom {@code long} values, |
723 |
< |
* each with the given origin and bound. |
723 |
> |
* each with the given origin and bound |
724 |
|
* @throws IllegalArgumentException if {@code streamSize} is |
725 |
|
* less than zero, or {@code randomNumberOrigin} |
726 |
|
* is greater than or equal to {@code randomNumberBound} |
747 |
|
* @param randomNumberOrigin the origin of each random value |
748 |
|
* @param randomNumberBound the bound of each random value |
749 |
|
* @return a stream of pseudorandom {@code long} values, |
750 |
< |
* each with the given origin and bound. |
750 |
> |
* each with the given origin and bound |
751 |
|
* @throws IllegalArgumentException if {@code randomNumberOrigin} |
752 |
|
* is greater than or equal to {@code randomNumberBound} |
753 |
|
*/ |
805 |
|
* @param randomNumberOrigin the origin of each random value |
806 |
|
* @param randomNumberBound the bound of each random value |
807 |
|
* @return a stream of pseudorandom {@code double} values, |
808 |
< |
* each with the given origin and bound. |
808 |
> |
* each with the given origin and bound |
809 |
|
* @throws IllegalArgumentException if {@code streamSize} is |
810 |
< |
* less than zero. |
810 |
> |
* less than zero |
811 |
|
* @throws IllegalArgumentException if {@code randomNumberOrigin} |
812 |
|
* is greater than or equal to {@code randomNumberBound} |
813 |
|
*/ |
833 |
|
* @param randomNumberOrigin the origin of each random value |
834 |
|
* @param randomNumberBound the bound of each random value |
835 |
|
* @return a stream of pseudorandom {@code double} values, |
836 |
< |
* each with the given origin and bound. |
836 |
> |
* each with the given origin and bound |
837 |
|
* @throws IllegalArgumentException if {@code randomNumberOrigin} |
838 |
|
* is greater than or equal to {@code randomNumberBound} |
839 |
|
*/ |