random number including 1 - i.e. [0,1]
dickinsm at gmail.com
Wed Jun 10 21:46:15 CEST 2009
On Jun 10, 8:15 pm, Robert Kern <robert.k... at 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
value, without also knowing *which* values of a and b are affected.
It can certainly be useful to know that endpoints *aren't* included
that's true. For example, knowing that random.random() can never
value 1.0 means that one can safely generate a mean 1 exponential
-log(1-random.random()), without worrying about the possibility of
But I don't know why it would be useful to know that endpoints *are*
included, without knowing exactly when.
More information about the Python-list