Reputation: 17164
I am using a computer with scipy version 1.0 and can not update the module. I need to create N lognormal points between a and b, How to create the random numbers?
from scipy import stats
x = stats.loguniform.rvs(1,10,size=100,random_state=100)
Scipy 1.0 does not have stats.lognormal it only has stats.lognorm with shape parameter.
Any methods using numpy or random modules with also be welcome it need not be only using scipy.
Upvotes: 0
Views: 180
Reputation: 114891
The distribution scipy.stats.loguniform
is just the new name of scipy.stats.reciprocal
, and reciprocal
is available in SciPy 1.0. So if loguniform
is what you need, you can use reciprocal
instead.
Note, however, that the log-uniform distribution is not the same as the log-normal distribution, so it is a bit confusing that the question asked for lognormal
random variates, but suggests loguniform
is an acceptable distribution. It sounds like what you really want is a truncated log-normal distribution.
Upvotes: 1