Re: number generator
- From: Steven D'Aprano <steve@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Sun, 11 Mar 2007 10:53:03 +1100
On Sat, 10 Mar 2007 08:29:09 -0800, Paul Rubin wrote:
Steven D'Aprano <steve@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx> writes:
Doesn't mean that it isn't random. After all, the first four numbers are
random, therefore their sum is random. 50 - (something random) is also
random.
What does it mean for the first 4 numbers to be random? For example,
is 27 random?
In isolation, no, but 27 could have been chosen at random and hence would
have been unpredictable. That was my point: if we generate four
unpredictable numbers (using random.randint or similar) and sum them, the
sum is also unpredictable, and hence the difference between 50 and that
sum is unpredictable.
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).
One common distribution which seems to have been missed is the Poisson
distribution, which applies to (among many, many others) the number of
18th Century Prussian cavalry officers who fell off their horse and broke
a limb, and the number of cars arriving at a petrol station in any hour.
--
Steven.
.
- Follow-Ups:
- Re: number generator
- From: Paul Rubin
- Re: number generator
- References:
- number generator
- From: cesco
- Re: number generator
- From: Steven D'Aprano
- Re: number generator
- From: Paul Rubin
- number generator
- Prev by Date: Re: number generator
- Next by Date: Re: Python 2.5 incompatible with Fedora Core 6 - packaging problems again
- Previous by thread: Re: number generator
- Next by thread: Re: number generator
- Index(es):
Relevant Pages
|