3 ms·
If you want a random number in [0,1] with a uniform distribution from N random bits, I don't see how you can expect an epsilon of less than 1/(2**N-1)
by shirleyquirk 5y ago
If you want a random number in [0,1] with a uniform distribution from N random bits, I don't see how you can expect an epsilon of less than 1/(2**N-1)
- adrianN 5y agoChoosing a random float is not the same as choosing a random number.
- morelisp 5y agoWhat applications call for a "random float in [0,1]" with distribution defined in the space of fp representation and not the usual kind?
- orlp 5y agoSure, but who said N has to be sizeof(int)? And besides that, the distance between x and successor(x) is not constant throughout the range of [0, 1).
- lupire 5y agoN is sizeof(float), which is conveniently the same as sizeof(int). > And besides that, the distance between x and successor(x) is That is approximately balanced by using random() int / MAXINT