There are two mathematically-defensible approaches here. The easy one samples from uniformly-spaced floating-point numbers on the interval: mask a random int to the number of significand bits, or with 1.0, subtract 1.0.https://twitter.com/ArvidGerstmann/status/1036661069878620161 …
-
-
Round *down* not towards zero.
-
(But also, you'll never produce 0 anyway, unless you're in Binary16, so. /shrug/)
-
Ah good point - the inputs you round are effectively ~1074 bits.
End of conversation
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.