Is it possible to define a strictly positive range for normal distribution like I want to have a distribution in the range (0,10)
with a certain mu, sigma
?
Using np.random.normal
, sometimes I get negative values which I don't want.
import numpy as np
I=np.random.normal(3, 10, size=(3,3))
CodePudding user response:
You should try 'scipy.stats.truncnorm' - quote The standard form of this distribution is a standard normal truncated to the range
https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.truncnorm.html