random.gauss: range

Raymond Hettinger python at rcn.com
Sat Feb 27 01:46:21 CET 2010

On Feb 26, 1:26 pm, pistacchio <pistacc... at gmail.com> wrote:
> hi,
> i'm trying the random.gauss function. can anyone explain how to get a
> number between a given range? like, from 0 to 20 with an average of
> 10? and how to determine the "steep" of the curve? i've never studied
> it, so mu and sigma don't really tell me a thing.

Try random.randrange() and random.triangular().
They are both easy to use and do not require you
to enter parameters that you don't understand.

FWIW, mu and sigma refer to the average and standard deviation
of a normal distribution.


More information about the Python-list mailing list