Lines Matching defs:bound

95     static final String BadBound = "bound must be positive";
96 static final String BadRange = "bound must be greater than origin";
237 * origin is greater than bound, acts as unbounded form of
240 * @param origin the least value, unless greater than bound
241 * @param bound the upper bound (exclusive), must not equal origin
244 final long internalNextLong(long origin, long bound) {
246 if (origin < bound) {
247 long n = bound - origin, m = n - 1;
258 while (r < origin || r >= bound)
268 * For the bounded case with representable range: uses nextInt(int bound)
271 * @param origin the least value, unless greater than bound
272 * @param bound the upper bound (exclusive), must not equal origin
275 final int internalNextInt(int origin, int bound) {
276 if (origin < bound) {
277 int n = bound - origin;
285 } while (r < origin || r >= bound);
297 * @param origin the least value, unless greater than bound
298 * @param bound the upper bound (exclusive), must not equal origin
301 final double internalNextDouble(double origin, double bound) {
303 if (origin < bound) {
304 r = r * (bound - origin) + origin;
305 if (r >= bound) // correct for rounding
306 r = Double.longBitsToDouble(Double.doubleToLongBits(bound) - 1);
337 * is pseudorandomly generated and returned. All {@code bound} possible
339 * probability. The method {@code nextInt(int bound)} is implemented by
342 * public int nextInt(int bound) {
343 * if (bound <= 0)
344 * throw new IllegalArgumentException("bound must be positive");
346 * if ((bound & -bound) == bound) // i.e., bound is a power of 2
347 * return (int)((bound * (long)next(31)) >> 31);
352 * val = bits % bound;
353 * } while (bits - val + (bound-1) < 0);
379 * @param bound the upper bound (exclusive). Must be positive.
381 * value between zero (inclusive) and {@code bound} (exclusive)
383 * @throws IllegalArgumentException if bound is not positive
386 public int nextInt(int bound) {
387 if (bound <= 0)
391 int m = bound - 1;
392 if ((bound & m) == 0) // i.e., bound is a power of 2
393 r = (int)((bound * (long)r) >> 31);
396 u - (r = u % bound) + m < 0;
650 * origin (inclusive) and bound (exclusive).
653 * calling the following method with the origin and bound:
655 * int nextInt(int origin, int bound) {
656 * int n = bound - origin;
664 * } while (r < origin || r >= bound);
671 * @param randomNumberBound the bound (exclusive) of each random value
673 * each with the given origin (inclusive) and bound (exclusive)
693 * int} values, each conforming to the given origin (inclusive) and bound
697 * calling the following method with the origin and bound:
699 * int nextInt(int origin, int bound) {
700 * int n = bound - origin;
708 * } while (r < origin || r >= bound);
717 * @param randomNumberBound the bound (exclusive) of each random value
719 * each with the given origin (inclusive) and bound (exclusive)
778 * (inclusive) and bound (exclusive).
781 * of calling the following method with the origin and bound:
783 * long nextLong(long origin, long bound) {
785 * long n = bound - origin, m = n - 1;
796 * while (r < origin || r >= bound)
804 * @param randomNumberBound the bound (exclusive) of each random value
806 * each with the given origin (inclusive) and bound (exclusive)
826 * long} values, each conforming to the given origin (inclusive) and bound
830 * of calling the following method with the origin and bound:
832 * long nextLong(long origin, long bound) {
834 * long n = bound - origin, m = n - 1;
845 * while (r < origin || r >= bound)
855 * @param randomNumberBound the bound (exclusive) of each random value
857 * each with the given origin (inclusive) and bound (exclusive)
918 * (inclusive) and bound (exclusive).
921 * of calling the following method with the origin and bound:
923 * double nextDouble(double origin, double bound) {
925 * r = r * (bound - origin) + origin;
926 * if (r >= bound) // correct for rounding
927 * r = Math.nextDown(bound);
933 * @param randomNumberBound the bound (exclusive) of each random value
935 * each with the given origin (inclusive) and bound (exclusive)
956 * double} values, each conforming to the given origin (inclusive) and bound
960 * of calling the following method with the origin and bound:
962 * double nextDouble(double origin, double bound) {
964 * r = r * (bound - origin) + origin;
965 * if (r >= bound) // correct for rounding
966 * r = Math.nextDown(bound);
974 * @param randomNumberBound the bound (exclusive) of each random value
976 * each with the given origin (inclusive) and bound (exclusive)
992 * versions into one class by treating a bound less than origin as
1003 final int bound;
1005 int origin, int bound) {
1007 this.origin = origin; this.bound = bound;
1013 new RandomIntsSpliterator(rng, i, index = m, origin, bound);
1029 consumer.accept(rng.internalNextInt(origin, bound));
1042 int o = origin, b = bound;
1058 final long bound;
1060 long origin, long bound) {
1062 this.origin = origin; this.bound = bound;
1068 new RandomLongsSpliterator(rng, i, index = m, origin, bound);
1084 consumer.accept(rng.internalNextLong(origin, bound));
1097 long o = origin, b = bound;
1114 final double bound;
1116 double origin, double bound) {
1118 this.origin = origin; this.bound = bound;
1124 new RandomDoublesSpliterator(rng, i, index = m, origin, bound);
1140 consumer.accept(rng.internalNextDouble(origin, bound));
1153 double o = origin, b = bound;