number generator

Paul Rubin http
Sun Mar 11 01:02:56 CET 2007

Steven D'Aprano <steve at> writes:
> > By your method, what is the probability of the first number being
> > higher than 30?  What is the probability of the fifth number being
> > higher than 30?  If these probabilities are unequal, can we really say
> > the sequences are random?
> Of course we can! "Uniform probability distribution" is a special case of
> random. Most random quantities are far from uniform. The Python random
> module includes a couple of non-uniform distributions, including
> exponential distribution (random.expovariate) and the famous bell curve
> distribution (random.normalvariate).

Ehh.  Say we call some generator repeatedly and get back the sequence
(3, 3, 3, 3, 3, ...).  Would we say this is a random sequence using a
distribution that puts 100% of the probability density at 3?  Or would
we just say it isn't random?

For something like this partition problem, describing some generator
as making a random partition should contain some reasonable
description of the distribution.  For example, we could say the
generator selects one of the P(n) possible partitions with equal
probability.  For another, we could say it uses the "fencepost" method
and the distribution is whatever results from that.  Question then is
whether those two distributions are the same.

More information about the Python-list mailing list