Reputation: 1725
I am not sure how to specify two arguments for the np.random.normal function:
How do I add this to this code?
np.random.normal(size = 100, loc = 68.32, scale = 25.7)
Upvotes: 1
Views: 672
Reputation: 2408
If you limit the minimum and maximum, the data will no longer be normally distributed. That's why it doesn't make sense for normal
to support such arguments.
If you want to pick numbers from normal distribution and subsequently limit to an interval, use something like:
data = np.random.normal(size=1000, loc=68.32, scale=25.7)
data_lim = data[np.where(np.logical_and(data > 10, data < 100))]
If you want numbers from an uniform distribution (which is naturally limited to a certain interval), see np.random.rand
Upvotes: 1