[NumPy-Tickets] [NumPy] #1690: numpy.random.randint(-2147483648, 2147483647) raises ValueError: low >= high

NumPy Trac numpy-tickets@scipy....
Tue Nov 30 13:13:27 CST 2010


#1690: numpy.random.randint(-2147483648, 2147483647) raises ValueError: low >=
high
--------------------+-------------------------------------------------------
 Reporter:  tkf     |       Owner:  somebody
     Type:  defect  |      Status:  new     
 Priority:  normal  |   Milestone:  2.0.0   
Component:  Other   |     Version:  1.5.0   
 Keywords:          |  
--------------------+-------------------------------------------------------
 Following example raises "ValueError: low >= high".
 It looks like it is due to overflow of "diff = hi - lo - 1" in
 RandomState.randint.

 {{{
 import numpy
 intinfo = numpy.iinfo(int)
 numpy.random.randint(-1, intinfo.max)  # raises nothing
 numpy.random.randint(intinfo.min, intinfo.max)
 ## numpy.random.randint(-2, intinfo.max)  # raises ValueError too
 }}}

-- 
Ticket URL: <http://projects.scipy.org/numpy/ticket/1690>
NumPy <http://projects.scipy.org/numpy>
My example project


More information about the NumPy-Tickets mailing list