robert.kern at gmail.com
Fri Feb 26 22:56:55 CET 2010
On 2010-02-26 15:26 PM, pistacchio wrote:
> i'm trying the random.gauss function. can anyone explain how to get a
> number between a given range?
You don't. The Gaussian distribution has infinite range. The best you can do
with the standard library is to keep sampling until you get a number inside your
desired range. If you aren't careful about your choice of parameters, this could
waste a lot of time.
> 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.
mu is the mean, the location of the central peak. sigma is the standard
deviation, which controls the width of the peak. Larger sigma means wider and
You may want another distribution, like random.betavariate():
"I have come to believe that the whole world is an enigma, a harmless enigma
that is made terrible by our own mad attempt to interpret it as though it had
an underlying truth."
-- Umberto Eco
More information about the Python-list