Ask Your Question

log-normal and gaussian distribution - array generation

asked 2013-11-01 11:19:36 +0200

mresimulator gravatar image

Hi experts!

I wanna generate a random number array of size=N using a log normal distribution. From i wanna use the parameters mu and sigma.

I know that I must do:

form scipy.stats import lognorm
new_array = lognorm.rvs(......, size=N)

What must I set like parameters (loc, s, scale, etc.) for use mu and sigma distribution parameters.

In the same way: what must I do in

new_array = norm.rvs(......, size=N)

for generate a array of random numbers using a gaussian distribution with parameters mu and sigma?

Waitign for your answers.

Thanks a lot!

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2013-11-01 13:08:17 +0200

calc314 gravatar image

updated 2013-11-01 13:10:43 +0200

You might also prefer to use numpy.random. You can get help at:

For example, try:

import numpy.random as rdm
edit flag offensive delete link more


Thanks a lot!!

mresimulator gravatar imagemresimulator ( 2013-11-05 13:12:01 +0200 )edit

answered 2013-11-01 13:03:58 +0200

Shashank gravatar image

You can convert a normal or log distribution with mu=0 and sigma=1, which is the default to whatever you want. For eg. for normal distribution you can use the following to get a normal distribution with sigma=10 and mu=1

from scipy.stats import norm
R = norm.rvs(size=10)
print sigma*R+mu
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools


Asked: 2013-11-01 11:19:36 +0200

Seen: 843 times

Last updated: Nov 01 '13