Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

So my concept for how it works was you're putting the random bits into the mantissa while holding the exponent constant, then normalizing the result.

Is that accurate? Is there any concern there for never getting the smallest possible values? Or is that acceptable because you can't generate values very close to 1?



That's close to one approach (generate a float in [1, 2) by setting the mantissa with a constant explonent of 1, and subtract 1), another is to generate a 32 or 64 bit integer and multiply by 2^-32 or 2^-64. I think both of these can generate all floats close to 1, it is the floats close to 0 that they're less good with.

There is some concern with the bias due to missing small values (and missing low bits, even for moderate values), but this is often ignored, and is usually good-enough.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: