I have a question regarding lognormal distribution. I want to create and ensemble of objects with "masses" from 10 to 10\*\*5 that are normally distributed. I thought this would be a a lognormal distribution and so I started trying to do this in python like so:

```
mu, sigma = 3., 1. # mean and standard deviation
s = np.random.lognormal(mu, sigma, 1000)
count, bins, ignored = plt.hist(s, 1000, density=True, align='mid')
x = np.linspace(min(bins), max(bins), 1000)
pdf = (np.exp(-(np.log(x) - mu)**2 / (2 * sigma**2)) / (x * sigma * np.sqrt(2 * np.pi)))
plt.plot(x, pdf, linewidth=2, color='r')
plt.xscale('log')
plt.show()

```

as is shown in the example from numpy, but changing mu and sigma and looking at the plots, I can't really tell if setting m and v (following the wikipedia article linked below) to 10\*\*5 and 1000 lets say gives me what I want

I looked at <https://en.wikipedia.org/wiki/Log-normal_distribution> to figure out how to calculate mu and sigma, but maybe im doing something else wrong. Is this the right approach to this problem?

I read previous questions/answers regarding the lognormal distribution, but i don't think they asked the same thing. Sorry in advanced if this type of question has already been answered.

mu, sigma = 3., 1. Is what's given in the example, This works fine, but when i change mu and sigma to values like:

```
m=10**3.5 #where I want the distribution to be centered
v=10000   #the "spread" that I want 
f=1.+(v/m2)
mu=np.log(m/np.sqrt(f))
sigma=np.sqrt(np.log(f))

```

I don't get what i expected.. which is a distribution centered around 10\*\*3.5 with a std of 10000.

Trying what was suggested:

```
mu=np.log(3000)
sigma=np.log(10)
s = np.random.lognormal(mu, sigma, 1000)
count, bins, ignored = plt.hist(s, 500, density=True, align='mid')
x = np.linspace(min(bins), max(bins), 1000)
pdf = (np.exp(-(np.log(x) - mu)**2 / (2 * sigma**2)) / (x * sigma * np.sqrt(2 * np.pi)))
plt.semilogx(x, pdf, linewidth=2, color='r')

```

This doesn't seem to work either, unless im misinterpreting the histogram
[histogram](https://i.stack.imgur.com/KTwBt.png)