Re: Bell-curve distribution wanted



On Feb 28, 11:20 am, mstem...@xxxxxxxxxxxxxxxx (Michael Stemper)
wrote:
For a simulation that I'm doing, I'd like to be able to generate
pseudo-random numbers with a "bell curve" distribution. My only
course in probability and statistics was one semester in high
school, in the late 1960s, and I didn't pay attention.

Given a random number in the interval [0.0,1.0], I can generate a
number in the interval [-1.0,1.0] that's somewhat more likely to
be in the middle than at the ends by simply multiplying it by its
absolute value. Cubing it will, of course, squeeze its distribution
in towards the center even more.

I tried walking up and down through the range, driven by coin flips,
but that gives too narrow a distribution if I use more than a few flips.

It seems to me that there must be a function that takes numbers
uniformly distributed over one range and produces numbers distributed
in a bell curve with a given standard deviation. What would a function
that does this look like? It doesn't even have to be exact, if there's
a choice between a complex function that is exact and a simple one
that's close (FSVO "close").

Any suggestions?

Use Python:

The following functions generate specific real-valued distributions.
Function parameters are named after the corresponding variables in the
distribution's equation, as used in common mathematical practice; most
of these equations can be found in any statistics text.


random( )
Return the next random floating point number in the range [0.0,
1.0).

uniform( a, b)
Return a random real number N such that a <= N < b.

betavariate( alpha, beta)
Beta distribution. Conditions on the parameters are alpha > -1
and beta > -1. Returned values range between 0 and 1.

expovariate( lambd)
Exponential distribution. lambd is 1.0 divided by the desired mean.
(The parameter would be called ``lambda'', but that is a reserved
word in Python.) Returned values range from 0 to positive infinity.

gammavariate( alpha, beta)
Gamma distribution. (Not the gamma function!) Conditions on the
parameters are alpha > 0 and beta > 0.

gauss( mu, sigma)
Gaussian distribution. mu is the mean, and sigma is the standard
deviation. This is slightly faster than the normalvariate()
function defined below.

lognormvariate( mu, sigma)
Log normal distribution. If you take the natural logarithm of
this distribution, you'll get a normal distribution with mean
mu and standard deviation sigma. mu can have any value, and
sigma must be greater than zero.

normalvariate( mu, sigma)
Normal distribution. mu is the mean, and sigma is the
standard deviation.

vonmisesvariate( mu, kappa)
mu is the mean angle, expressed in radians between 0 and 2*pi,
and kappa is the concentration parameter, which must be greater
than or equal to zero. If kappa is equal to zero, this
distribution reduces to a uniform random angle over the range 0 to
2*pi.

paretovariate( alpha)
Pareto distribution. alpha is the shape parameter.

weibullvariate( alpha, beta)
Weibull distribution. alpha is the scale parameter and beta is
the shape parameter.

.



Relevant Pages

  • Re: RNG for non-uniform distributions
    ... Just curious as to if there are some algorithms for other than the uniform ... distribution since that is the only RNG's I have seen. ... Conditions on the parameters are alpha> -1 ... mu is the mean, and sigma is ...
    (sci.math)
  • Re: RNG for non-uniform distributions
    ... distribution since that is the only RNG's I have seen. ... uniform(a, b) ... Conditions on the parameters are alpha> -1 ... mu is the mean, and sigma is ...
    (sci.math)
  • Re: RNG for non-uniform distributions
    ... distribution since that is the only RNG's I have seen. ... uniform(a, b) ... Conditions on the parameters are alpha> -1 ... mu is the mean, and sigma is ...
    (sci.math)
  • distribution of n point on the unit circle
    ... What is the probability density function or the distribution ... function for the smallest angle alpha such that all points are on a ... alpha cannot be bigger than pi. ...
    (sci.math)
  • Splitting samples to minimize false positives?
    ... given alpha as to whether that sample came from that same distribution ... the false positive rate (fpr) will be alpha simply by chance. ... % a normal distribution to see how often it fails ...
    (sci.stat.math)