Robert Kern <robert.k...@gmail.com> wrote: > On 2009-06-10 14:46, Mark Dickinson wrote: >> On Jun 10, 8:15 pm, Robert Kern<robert.k...@gmail.com> wrote: >>> On 2009-06-10 13:53, Terry Reedy wrote: >>>> A full technical discussion does not below in the docs, in my opinion. A >>>> wike article would be fine. >>> True. However, a brief note that "Due to floating point arithmetic, for some >>> values of a and b, b may or may not be one of the possible generated >>> results." >>> might be worthwhile. The actual details of *why* this is the case can be >>> discussed elsewhere. >> >> I find it difficult to see how such a disclaimer would have any >> practical value >> [lots more badly wrapped text snipped... ] > > That's a fair point. However, one issue that hasn't been brought up is that > it > might be confusing to a user why random.random() returns values in a > half-open > interval while random.uniform() claims a closed interval. Even for reasonably > sophisticated floating point users, it's not necessarily obvious that that is > the reasoning behind the different claims.
True. I guess the original post in this thread is good evidence of that. Though I'm not sure I'm capable of coming up with extra wording for the docs that won't just cause more confusion, so I'll leave that to someone else. I seem to recall that when this originally came up in the tracker (issue 4979) the fun part of the analysis was proving that random.uniform(a, b) can never produce values *outside* the interval [a, b]. :-) -- Mark Dickinson -- http://mail.python.org/mailman/listinfo/python-list