title: A random normally distributed matrix in numpy
body: <p>I would like to generate a matrix M, whose elements M(i,j) are from a standard normal distribution. One trivial way of doing it is,</p>
  
  <pre><code>import numpy as np
  
  A = [ [np.random.normal() for i in range(3)]    for j in range(3) ]
  A = np.array(A)
  print(A)
  
  [[-0.12409887  0.86569787 -1.62461893]
   [ 0.30234536  0.47554092 -1.41780764]
   [ 0.44443707 -0.76518672 -1.40276347]]
  </code></pre>
  
  <p>But, I was playing around with numpy and came across another "solution":</p>
  
  <pre><code>import numpy as np
  import numpy.matlib as npm
  
  A = np.random.normal(npm.zeros((3, 3)), npm.ones((3, 3)))
  print(A)
  
  [[ 1.36542538 -0.40676747  0.51832243]
   [ 1.94915748 -0.86427391 -0.47288974]
   [ 1.9303462  -1.26666448 -0.50629403]]
  </code></pre>
  
  <p>I read the <a href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.random.normal.html" rel="nofollow noreferrer">document</a> for <code>numpy.random.normal</code>, and it says it doesn't clarify how does this function work when matrix is passed instead of a single value. I suspected that in the second "solution" I might be drawing from a multivariate normal distribution. But this can't be true because the input arguments both have the same dimensions (covariance should be a matrix and mean is a vector). Not sure what is being generated by the second code.</p>