Hacker News new | ask | show | jobs
by alepper 4107 days ago
The clue's here:

> What is the `uniform' distribution we want, anyway? It is obviously not the uniform discrete distribution on the finite set of floating-point numbers in [0, 1] -- that would be silly. For our `uniform' distribution, we would like to imagine[*] drawing a real number in [0, 1] uniformly at random, and then choosing the nearest floating-point number to it.

Because of the logarithmic representation, there are as many floating point numbers between .25 and .5 as there are between .5 and 1. If you uniformly sample numbers with an exact, finite floating point representation then you don't get something that 'looks like' a uniform distribution of real numbers in [0, 1] -- which is more likely what was wanted.

2 comments

Bingo. The ongoing mindfuck of floating point representations is that sort of non-even mapping of certain intervals.
Right, which is why I said you'd have to account for the log bias when you pick a random integer exponent. Otherwise most of your results would be really tiny.

The method bhickey suggests above sounds like a nifty workaround for the problem as well.

You're right, sorry. I responded to 'why round?' but missed that comment.