[Numpy-discussion] Sintax differences

Nathan Bell wnbell@gmail....
Fri Jun 20 04:59:57 CDT 2008


On Fri, Jun 20, 2008 at 4:28 AM, izak marais <izakmarais@yahoo.com> wrote:
> Hi
>
> Is there a reason why the syntax is rand(n,n), but zeros((n,n)) to create an
> n*n array? If not, perhaps this could be cleaned up?
>

SciPy's rand() is just a convenience wrapper:


>>> help(rand)
Help on built-in function rand:

rand(...)
    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).


-- 
Nathan Bell wnbell@gmail.com
http://graphics.cs.uiuc.edu/~wnbell/


More information about the Numpy-discussion mailing list