[Numpy-discussion] Re: [Numpy-user] random.randint bug ?

Robert Kern robert.kern at gmail.com
Thu Mar 23 08:25:11 CST 2006


Randewijk P-J <pjrandew at sun.ac.za> wrote:
> I'm having problems with randint:
> 
> 
>>>>random.randint(low=1,high=10)
> 
> 4L
> 
>>>>random.randint(low=1,high=10)
> 
> 7L
> 
>>>>random.randint(low=1,high=10)
> 
> 5L
> 
>>>>random.randint(low=1,high=10)
> 
> 7L
> 
>>>>random.randint(low=1,high=10)
> 
> 4L
> 
>>>>random.randint(low=1,high=10)
> 
> 0L
> 
> The last value is wrong because it is < "low"/"1"
> 
> The randint value should be: 1 <= value < 10
> 
>>>>help(random.randint)
> 
> Help on built-in function randint:
> 
> randint(...)
>     Return random integers x such that low <= x < high.
>     
>     randint(low, high=None, size=None) -> random values
>     
>     If high is None, then 0 <= x < low.
> 
> 
> 
> Running Python 2.4.2 and NumPy 0.9.6

Fixed in SVN. Thank you.

-- 
Robert Kern
robert.kern at gmail.com

"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 Numpy-discussion mailing list