Ask Your Question

log-normal and gaussian distribution - array generation

asked 2013-11-01 05:19:36 -0500

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 07:08:17 -0500

calc314 gravatar image

updated 2013-11-01 07:10:43 -0500

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 06:12:01 -0500 )edit

answered 2013-11-01 07:03:58 -0500

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 05:19:36 -0500

Seen: 536 times

Last updated: Nov 01 '13