You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
One would expect a truly, full spectrum random number from the interval [Double.MinValue Double.MaxValue) instead this code always returns 1.7976931348623155E308.
The text was updated successfully, but these errors were encountered:
FTR, there is a correct implementation of nextDouble(origin, bound) in the following Scala.js PR: scala-js/scala-js#5142
It corresponds to what su.Random calls between. A fix could be taken from there.
obviously always returning 1.7976931348623155E308 is undesirable and we should do better
but that said, I'm not sure how meaningful it is to ask for a random floating point number over such a wide range — IEEE 754 gets weird once huge numbers are involved, the numbers that are even representable are farther and farther apart from each other. I'm not sure what "truly, full spectrum" even means in this context. (I would imagine there's literature on this...?)
regardless, it seems that a PR porting what Scala.js did would be welcome
Reproduction steps
See this Scastie.
Problem
One would expect a truly, full spectrum random number from the interval
[Double.MinValue Double.MaxValue)
instead this code always returns1.7976931348623155E308
.The text was updated successfully, but these errors were encountered: