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

Personally, I’m approaching this from a documentation standpoint. Our current docs say:

concrete floating point types sample from [0, 1)

This should say more, even with the status quo implementations. Perhaps something like:

The types Float16, Float32, and Float64 return values in [0, 1) as though a random variable were drawn from a theoretically ideal uniform distribution and then rounded down to the previous multiple of eps(T)/2 (this value may decrease in the future).

I’d want to be able to say:

The types Float16, Float32, and Float64 return values in [0, 1) as though a random variable were drawn from a theoretically ideal uniform distribution and then rounded down to the previous floating point number.

10 Likes