[NumPy-Tickets] [NumPy] #965: random_integers error regarding integer value range (was: random_integers error message should be more explicit when in its arguments overflow)

NumPy Trac numpy-tickets@scipy....
Mon Feb 21 20:14:27 CST 2011

#965: random_integers error regarding integer value range
 Reporter:  cdavid               |       Owner:  cdavid
     Type:  defect               |      Status:  new   
 Priority:  high                 |   Milestone:        
Component:  numpy.random         |     Version:  1.4.1 
 Keywords:  integer value range  |  
Changes (by pavi):

  * keywords:  => integer value range
  * priority:  normal => high
  * version:  none => 1.4.1


 == not only a false error message ==

 as I understand this, the value range '''should''' be allowed.


 In [551]:int32(-(2**31))


 In [553]:int32((2**31)-1)


 2*(2**31) = 2**32, which is the number of values an integer can assume.
 there is some limit-checking bug.


 In [550]:numpy.random.random_integers(low=int32(-(2**31)+1),
 high=int32((2**31)-1), size=10)
 ValueError                                Traceback (most recent call

 /home/...../Python/<ipython console> in <module>()

 /usr/lib/pymodules/python2.6/numpy/random/mtrand.so in
 mtrand.RandomState.random_integers (numpy/random/mtrand/mtrand.c:6640)()

 /usr/lib/pymodules/python2.6/numpy/random/mtrand.so in
 mtrand.RandomState.randint (numpy/random/mtrand/mtrand.c:5854)()

 ValueError: low >= high

Ticket URL: <http://projects.scipy.org/numpy/ticket/965#comment:3>
NumPy <http://projects.scipy.org/numpy>
My example project

More information about the NumPy-Tickets mailing list