More efficient double generation in JS

This commit is contained in:
Ilya Gorbunov
2018-07-05 06:06:39 +03:00
parent b96803248f
commit 35c927214d
3 changed files with 13 additions and 2 deletions
@@ -31,6 +31,9 @@ internal actual inline fun defaultPlatformRandom(): Random =
internal actual fun fastLog2(value: Int): Int =
31 - Integer.numberOfLeadingZeros(value)
internal actual fun doubleFromParts(hi26: Int, low27: Int): Double =
(hi26.toLong().shl(27) + low27) / (1L shl 53).toDouble()
internal abstract class AbstractPlatformRandom : Random() {
abstract val impl: java.util.Random