Generating N random data sets from a sample of n values following a normal distribution? (Python)

I want to generate N random data sets from a list of random numbers. I can generate n random values easily using this:

normal(loc=mu, scale=sigma, size=n)

where loc is the mean, scale is standard deviation, size is the number of values.

But now I want to repeat this random generators N times to create N data sets all different from each other. Can anyone help? I feel like this isn’t difficult to do, but I’m very new to programming.

Answer

If you want n samples of k values generated from a normal distribution, then

np.random.normal(loc=mu, scale=sigma, size=(n, k))

Example:

>>> mu, sigma, n, k = 0, 0.1, 10, 5
>>> np.random.normal(loc=mu, scale=sigma, size=(n, k))
array([[-0.07518366, -0.1949778 , -0.00940813,  0.00993604, -0.07682189],
       [-0.03299335,  0.01224153,  0.15198659,  0.18654867,  0.18538708],
       [-0.10499824,  0.11863809, -0.08196595, -0.07259012, -0.13982268],
       [ 0.08297579, -0.08121311,  0.19496005,  0.00710787,  0.04434566],
       [ 0.00057888, -0.18052104, -0.02845761,  0.03330374, -0.08525697],
       [-0.11370541,  0.01166695, -0.09914575,  0.14135651, -0.03463862],
       [-0.13043708,  0.16128385,  0.03448309,  0.20302464,  0.02949679],
       [-0.08506748, -0.08459261,  0.05036709, -0.05956242, -0.10132293],
       [ 0.07130109, -0.01409814, -0.06980729,  0.05180577,  0.19270917],
       [ 0.04884829, -0.02219597,  0.04511094, -0.10689077, -0.00715145]])