3 ms·
I love this trick. It generates a float of the form 1.xxxxx..., filling in the x part with random bits, generating a random number between 1 and 2. Then it subt
by pjscott 8y ago
I love this trick. It generates a float of the form 1.xxxxx..., filling in the x part with random bits, generating a random number between 1 and 2. Then it subtracts 1.
- FabHK 8y agoNote though that the least significant bit of your float will always be zero, if I understand correctly (and the subsequent ones will be zero more often than not). PRNG are tricky, and floats are tricky, and the combination is tricky, unsurprisingly. See this discussion here: https://github.com/JuliaLang/julia/issues/16344 https://github.com/JuliaLang/julia/issues/16344
- pjscott 8y agoAw, man. Some day we'll have this all figured out, but that day won't be soon.