8288173: JDK-8202449 fix causes conformance test failure : api/java_util/Random/RandomGenerator/NextFloat.html

Reviewed-by: bpb, darcy
This commit is contained in:
Raffaello Giulietti 2022-06-10 21:01:14 +00:00 committed by Brian Burkhalter
parent f2e10dce78
commit da2339cf69

View File

@ -733,7 +733,7 @@ public class RandomSupport {
r = (r * (0.5f * bound - halfOrigin) + halfOrigin) * 2.0f;
}
if (r >= bound) // may need to correct a rounding problem
r = Math.nextDown(r);
r = Math.nextDown(bound);
}
return r;
}
@ -765,7 +765,7 @@ public class RandomSupport {
float r = rng.nextFloat();
r = r * bound;
if (r >= bound) // may need to correct a rounding problem
r = Math.nextDown(r);
r = Math.nextDown(bound);
return r;
}