[Numpy-discussion] numpy.random.rand function doesn't take tuple

Travis Oliphant oliphant at ee.byu.edu
Mon Aug 21 14:02:05 CDT 2006

David Grant wrote:

>I was a bit surprised today to find that numpy.random.rand doesn't
>take in a tuple as input for the dimensions of the desired array. I am
>very used to using a tuple for zeros, ones. Also, wouldn't this mean
>that it would not be possible to add other non-keyword arguments to
>rand later?


    Return an array of the given dimensions which is initialized to
    random numbers from a uniform distribution in the range [0,1).

    rand(d0, d1, ..., dn) -> random values

    Note:  This is a convenience function. If you want an
                interface that takes a tuple as the first argument
                use numpy.random.random_sample(shape_tuple).

More information about the Numpy-discussion mailing list