Providing multiple values to either the loc
or scale
arguments can be used to generate multiple random distributions at once with different parameters. In the code you provided the values for the loc
argument are the same, meaning that you could also just use the value -2
instead of (-2, -2)
. You can see this when fixing the seed and generating new numbers
import numpy as np
np.random.seed(0)
print(np.random.normal((-2, -2), size=(5,2)))
# [[-0.23594765 -1.59984279]
# [-1.02126202 0.2408932 ]
# [-0.13244201 -2.97727788]
# [-1.04991158 -2.15135721]
# [-2.10321885 -1.5894015 ]]
np.random.seed(0)
print(np.random.normal(-2, size=(5,2)))
# [[-0.23594765 -1.59984279]
# [-1.02126202 0.2408932 ]
# [-0.13244201 -2.97727788]
# [-1.04991158 -2.15135721]
# [-2.10321885 -1.5894015 ]]
The different between the two lines is that one is generating random noise from a normal (Gaussian) distribution with a mean of -2 and the other from a mean of 2, see also the loc
keyword in the documentation.