Skip to content

Commit c146755

Browse files
committed
Merge pull request scala-js#2145 from nicolasstucki/port-miscellaneous-tests
Port miscellaneous tests.
2 parents c87d8d5 + 35d8cbb commit c146755

File tree

20 files changed

+1554
-1535
lines changed

20 files changed

+1554
-1535
lines changed

javalib/src/main/scala/java/util/concurrent/ThreadLocalRandom.scala

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,13 @@ class ThreadLocalRandom extends Random {
106106
if (least >= bound)
107107
throw new IllegalArgumentException()
108108

109-
nextDouble() * (bound - least) + least
109+
/* Based on documentation for Random.doubles to avoid issue #2144 and other
110+
* possible rounding up issues:
111+
* https://docs.oracle.com/javase/8/docs/api/java/util/Random.html#doubles-double-double-
112+
*/
113+
val next = nextDouble() * (bound - least) + least
114+
if (next < bound) next
115+
else Math.nextAfter(bound, Double.NegativeInfinity)
110116
}
111117
}
112118

test-suite/js/src/test/require-jdk7/org/scalajs/testsuite/javalib/util/ObjectsTestOnJDK7.scala

Lines changed: 0 additions & 84 deletions
This file was deleted.

0 commit comments

Comments
 (0)