random number including 1 - i.e. [0,1]

Robert Kern robert.kern at gmail.com
Wed Jun 10 16:35:14 EDT 2009


On 2009-06-10 15:32, Robert Kern wrote:
> On 2009-06-10 14:46, Mark Dickinson wrote:

>> But I don't know why it would be useful to know that endpoints *are*
>> sometimes
>> included, without knowing exactly when.
>
> 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.

Basically, if we can forestall another tedious thread about imagined asymmetry 
and "hemispatial neglect" with a single sentence, I'm all for it.

:-)

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
  that is made terrible by our own mad attempt to interpret it as though it had
  an underlying truth."
   -- Umberto Eco




More information about the Python-list mailing list