[SciPy-user] random gaussian array

Alan G Isaac aisaac at american.edu
Tue Nov 13 08:35:26 EST 2007


On Tue, 13 Nov 2007, sandric ionut apparently wrote:
> I looked at numpy.random, but all I have is normalvariate 

But that matches your question?
If you use ``normal``, just set the size (i.e., shape).

Cheers,
Alan Isaac


>>> help(N.random)
Help on package numpy.random in numpy:
...
    multivariate_normal(...)
        Return an array containing multivariate normally distributed random numbers
        with specified mean and covariance.

        multivariate_normal(mean, cov) -> random values
        multivariate_normal(mean, cov, [m, n, ...]) -> random values

        mean must be a 1 dimensional array. cov must be a square two dimensional
        array with the same number of rows and columns as mean has elements.

        The first form returns a single 1-D array containing a multivariate
        normal.

        The second form returns an array of shape (m, n, ..., cov.shape[0]).
        In this case, output[i,j,...,:] is a 1-D array containing a multivariate
        normal.

    normal(...)
        Normal distribution (mean=loc, stdev=scale).

        normal(loc=0.0, scale=1.0, size=None) -> random values





More information about the SciPy-User mailing list