[Numpy-discussion] rand argument question

Robert Kern robert.kern at gmail.com
Fri Jun 2 12:16:31 EDT 2006

Sven Schreiber wrote:
> Hi all,
> this may be a stupid question, but why doesn't rand accept a shape tuple
> as argument? I find the difference between the argument types of rand
> and (for example) zeros somewhat confusing. (See below for
> illustration.) Can anybody offer an intuition/explanation?

rand() is a convenience function. It's only purpose is to offer this convenient
API. If you want a function that takes tuples, use numpy.random.random().

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 NumPy-Discussion mailing list