I don't know if this is the right place to report bugs, but I couldn't find
anywhere else on the website...

random.randint(min,max) from python core returns an integer between min and
max inclusive. The documentation on the website says that
numpy.random.randint(min,max [,size]) does this too, but it in fact only
ever returns numbers strictly less than the max, and gives an error if min
is equal to max



Python 2.4.4 (#1, Dec 20 2007, 08:43:49)
[GCC 4.1.2 20070214 (  (gdc 0.24, using dmd 1.020)) (Gentoo 4.1.2 p1.0.2)]
on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import random
>>> import numpy.random
>>> numpy.version.version
'1.0.4'
>>> random.randint(3,3)
3
>>> numpy.random.randint(3,3)
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "mtrand.pyx", line 600, in mtrand.RandomState.randint
ValueError: low >= high
>>> numpy.random.randint(1,3,(2,10))
array([[2, 1, 2, 1, 2, 1, 2, 1, 2, 1],
       [1, 2, 1, 2, 1, 1, 1, 2, 1, 2]])

_______________________________________________
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to