3 ms·
You most certainly can. If you follow the github links in that blog post, you'll see in arbitrary_range.c that that's exactly what I do in "rd_positive". Pick
by art4711 12y ago
You most certainly can.
If you follow the github links in that blog post, you'll see in arbitrary_range.c that that's exactly what I do in "rd_positive". Pick the highest number in the range, calculate the distance to next lower representable number, only return multiples of that (bounded by the total number of those distances within the range). For IEEE 754 doubles, unless your range can't represent that many doubles at all it makes you end up with somewhere between 52 and 53 bits of entropy per number generated.
- Someone 12y agoBut doesn't that mean that you decide to split he set of represent able numbers in gate range in those that your code can return and those that it will never return? Yes, the ones that you decide to return all have the same probability. The ones that you decide to never return have Rob ability zero. That is not "so that any particular floating number is no more likely to be picked than any other."
- SamReidHughes 12y agoIt's referring to the numbers that could be picked at all.