Output distribution of rand(Float32) and rand(Float64), thread 2

Personally, I’ve always been scared (perhaps unreasonably so) to muck around with rand()'s output. I’m not sure where this trepidation came from, but it predates Julia — I remember fretting about hand-written re-computations of random distributions in Matlab and C in the 00s. I don’t think it really matter whether the output distribution is evenly spaced or if it’s logarithmic; either way, floating point challenges aren’t too far away.

In my view, getting random distributions right is the work of magicians — along the same lines as getting encryption right is (if not even more fundamental). To wit, the straw-stuffed implementation in the first thread on this isn’t generating a correct uniform distribution AFAICS — so we don’t have a solid view on what such a performance impact would be, but it’ll certainly be worse than what’s there.

4 Likes