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

Backport-of: da2339cf6971532593e4f1b5ebbce8d1ed2e83b2
This commit is contained in:
Joe Darcy 2022-06-11 00:44:15 +00:00
parent d9c1364dde
commit f4b05a1168

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;
}