@@ -516,9 +516,10 @@ default float nextFloat() {
516
516
* @throws IllegalArgumentException if {@code bound} is not
517
517
* both positive and finite
518
518
*
519
- * @implSpec The default implementation simply calls
520
- * {@link RandomSupport#checkBound checkBound}(bound) and then
521
- * {@link RandomSupport#boundedNextFloat boundedNextFloat}(this, bound).
519
+ * @implSpec The default implementation checks that {@code bound} is a
520
+ * positive finite float. Then invokes {@code nextFloat()}, scaling
521
+ * the result so that the final result lies between {@code 0.0f} (inclusive)
522
+ * and {@code bound} (exclusive).
522
523
*/
523
524
default float nextFloat (float bound ) {
524
525
RandomSupport .checkBound (bound );
@@ -540,9 +541,11 @@ default float nextFloat(float bound) {
540
541
* or {@code bound} is not finite, or {@code origin}
541
542
* is greater than or equal to {@code bound}
542
543
*
543
- * @implSpec The default implementation simply calls
544
- * {@link RandomSupport#checkBound checkBound}(bound) and then
545
- * {@link RandomSupport#boundedNextFloat boundedNextFloat}(this, bound).
544
+ * @implSpec The default implementation checks that {@code origin} and
545
+ * {@code bound} are positive finite floats. Then invokes
546
+ * {@code nextFloat()}, scaling and translating the result so that the final
547
+ * result lies between {@code origin} (inclusive) and {@code bound}
548
+ * (exclusive).
546
549
*/
547
550
default float nextFloat (float origin , float bound ) {
548
551
RandomSupport .checkRange (origin , bound );
@@ -577,9 +580,10 @@ default double nextDouble() {
577
580
* @throws IllegalArgumentException if {@code bound} is not
578
581
* both positive and finite
579
582
*
580
- * @implSpec The default implementation simply calls
581
- * {@link RandomSupport#checkBound checkBound}(bound) and then
582
- * {@link RandomSupport#boundedNextDouble boundedNextDouble}(this, bound).
583
+ * @implSpec The default implementation checks that {@code bound} is a
584
+ * positive finite double. Then invokes {@code nextDouble()}, scaling
585
+ * the result so that the final result lies between {@code 0.0} (inclusive)
586
+ * and {@code bound} (exclusive).
583
587
*/
584
588
default double nextDouble (double bound ) {
585
589
RandomSupport .checkBound (bound );
@@ -601,9 +605,11 @@ default double nextDouble(double bound) {
601
605
* or {@code bound} is not finite, or {@code origin}
602
606
* is greater than or equal to {@code bound}
603
607
*
604
- * @implSpec The default implementation simply calls
605
- * {@link RandomSupport#checkBound checkBound}(bound) and then
606
- * {@link RandomSupport#boundedNextDouble boundedNextDouble}(this, bound).
608
+ * @implSpec The default implementation checks that {@code origin} and
609
+ * {@code bound} are positive finite doubles. Then calls
610
+ * {@code nextDouble()}, scaling and translating the result so that the final
611
+ * result lies between {@code origin} (inclusive) and {@code bound}
612
+ * (exclusive).
607
613
*/
608
614
default double nextDouble (double origin , double bound ) {
609
615
RandomSupport .checkRange (origin , bound );
@@ -627,16 +633,20 @@ default int nextInt() {
627
633
* Returns a pseudorandomly chosen {@code int} value between zero
628
634
* (inclusive) and the specified bound (exclusive).
629
635
*
630
- * @param bound the upper bound (exclusive) for the returned value. Must be positive.
636
+ * @param bound the upper bound (exclusive) for the returned value.
637
+ * Must be positive.
631
638
*
632
639
* @return a pseudorandomly chosen {@code int} value between
633
640
* zero (inclusive) and the bound (exclusive)
634
641
*
635
642
* @throws IllegalArgumentException if {@code bound} is not positive
636
643
*
637
- * @implSpec The default implementation simply calls
638
- * {@link RandomSupport#checkBound checkBound}(bound) and then
639
- * {@link RandomSupport#boundedNextInt boundedNextInt}(this, bound).
644
+ * @implSpec The default implementation checks that {@code bound} is a
645
+ * positive {@code int}. Then invokes {@code nextInt()}, limiting the result
646
+ * to be greater than or equal zero and less than {@code bound}. If {@code bound}
647
+ * is a power of two then limiting is a simple masking operation. Otherwise,
648
+ * the result is re-calculated by invoking {@code nextInt()} until the
649
+ * result is greater than or equal zero and less than {@code bound}.
640
650
*/
641
651
default int nextInt (int bound ) {
642
652
RandomSupport .checkBound (bound );
@@ -657,9 +667,13 @@ default int nextInt(int bound) {
657
667
* @throws IllegalArgumentException if {@code origin} is greater than
658
668
* or equal to {@code bound}
659
669
*
660
- * @implSpec The default implementation simply calls
661
- * {@link RandomSupport#checkBound(long) checkBound}(bound) and then
662
- * {@link RandomSupport#boundedNextInt(RandomGenerator, int) boundedNextInt}(this, bound).
670
+ * @implSpec The default implementation checks that {@code origin} and
671
+ * {@code bound} are positive {@code ints}. Then invokes {@code nextInt()},
672
+ * limiting the result to be greater that or equal {@code origin} and less
673
+ * than {@code bound}. If {@code bound} is a power of two then limiting is a
674
+ * simple masking operation. Otherwise, the result is re-calculated by
675
+ * invoking {@code nextInt()} until the result is greater than or equal
676
+ * {@code origin} and less than {@code bound}.
663
677
*/
664
678
default int nextInt (int origin , int bound ) {
665
679
RandomSupport .checkRange (origin , bound );
@@ -678,16 +692,21 @@ default int nextInt(int origin, int bound) {
678
692
* Returns a pseudorandomly chosen {@code long} value between zero
679
693
* (inclusive) and the specified bound (exclusive).
680
694
*
681
- * @param bound the upper bound (exclusive) for the returned value. Must be positive.
695
+ * @param bound the upper bound (exclusive) for the returned value.
696
+ * Must be positive.
682
697
*
683
698
* @return a pseudorandomly chosen {@code long} value between
684
699
* zero (inclusive) and the bound (exclusive)
685
700
*
686
701
* @throws IllegalArgumentException if {@code bound} is not positive
687
702
*
688
- * @implSpec The default implementation simply calls
689
- * {@link RandomSupport#checkBound checkBound}(bound) and then
690
- * {@link RandomSupport#boundedNextLong boundedNextLong}(this, bound).
703
+ * @implSpec The default implementation checks that {@code bound} is a
704
+ * positive {@code long}. Then invokes {@code nextLong()}, limiting the
705
+ * result to be greater than or equal zero and less than {@code bound}. If
706
+ * {@code bound} is a power of two then limiting is a simple masking
707
+ * operation. Otherwise, the result is re-calculated by invoking
708
+ * {@code nextLong()} until the result is greater than or equal zero and
709
+ * less than {@code bound}.
691
710
*/
692
711
default long nextLong (long bound ) {
693
712
RandomSupport .checkBound (bound );
@@ -708,9 +727,13 @@ default long nextLong(long bound) {
708
727
* @throws IllegalArgumentException if {@code origin} is greater than
709
728
* or equal to {@code bound}
710
729
*
711
- * @implSpec The default implementation simply calls
712
- * {@link RandomSupport#checkBound checkBound}(bound) and then
713
- * {@link RandomSupport#boundedNextLong boundedNextLong}(this, bound).
730
+ * @implSpec The default implementation checks that {@code origin} and
731
+ * {@code bound} are positive {@code longs}. Then invokes {@code nextLong()},
732
+ * limiting the result to be greater than or equal {@code origin} and less
733
+ * than {@code bound}. If {@code bound} is a power of two then limiting is a
734
+ * simple masking operation. Otherwise, the result is re-calculated by
735
+ * invoking {@code nextLong()} until the result is greater than or equal
736
+ * {@code origin} and less than {@code bound}.
714
737
*/
715
738
default long nextLong (long origin , long bound ) {
716
739
RandomSupport .checkRange (origin , bound );
@@ -892,10 +915,6 @@ interface SplittableGenerator extends StreamableGenerator {
892
915
* Returns an instance of {@link SplittableGenerator} that utilizes the
893
916
* {@code name} <a href="package-summary.html#algorithms">algorithm</a>.
894
917
*
895
- * @implNote Availability is determined by RandomGeneratorFactory using the
896
- * service provider API to locate implementations of the RandomGenerator
897
- * interface and filtering on the SplittableGenerator interface.
898
- *
899
918
* @param name Name of random number generator
900
919
* <a href="package-summary.html#algorithms">algorithm</a>
901
920
*
0 commit comments