Re: Dice
Re: Dice
- Subject: Re: Dice
- From: "Dennis W. Manasco" <email@hidden>
- Date: Sat, 30 Oct 2004 05:55:10 -0500
At 12:46 PM -0400 10/26/04, Graff wrote:
I just ran it 1000 times and got the following distribution:
1 161
...
6 160
std deviation = 5.16
So no, it doesn't seem to be perfect but it's probably good enough
for most applications.
This discussion of random numbers and pseudo-random number generators
pushes one of my hot-buttons, so please excuse me if I rant a little.
Random numbers are, by definition, RANDOM.
That means that, for any random number generator, each subsequent
number generated must be completely and entirely independent of any
previously generated number (and of any subsequently generated
number). This applies to both physical and programmatic "random
number generators".
That means that random number generators have _by_definition_ no
predictable distribution for sample sizes that are less than
infinite. The distribution of a "perfect" pseudo-random number
generator should be flat, but only when it generates an infinite
number of samples; the first 600 billion samples are just cannon
fodder.
The standard deviation of a very small sample is introduced to
indicate that a function may be less than random.
The standard deviation of a population is (to quote
<http://computing-dictionary.thefreedictionary.com/standard deviation>)
"a statistic used as a measure of the dispersion or variation in a
distribution, equal to the square root of the arithmetic mean of the
squares of the deviations from the arithmetic mean."
But, a random sequence does not have a normal distribution and has,
by definition, no useful mean except in the infinite case where the
mean is, by definition, the mid-point of the chosen range and the
population distribution is flat over the entire range.
Think of flipping a perfectly balanced coin. This is a random act:
past and future flips of the coin have no influence on the current
flip.
It is possible to flip this perfect coin a million times and always
get "heads." The statistical probability that you will do so is
incredibly small, but that doesn't make the coin an invalid random
number generator.
Similarly, you could go to Vegas and roll a natural seven every time
you picked up perfect dice for two weeks. The chance of that
happening is vanishingly small, but that doesn't mean that it is
impossible, nor does it mean that the dice did not generate "random"
rolls.
Good pseudo-random number generators should be just like those coins
and dice: They should have no quantifiable distribution in any
non-infinite analysis
So how do you tell whether a random number generator is good or not?
That is a very complex question, reading Volume 3 of Knuth is
probably a good start at answering it.
And now my hottest button issue about random numbers:
If you find a good random number generator, please, please, please
don't re-seed it.
The easiest way to kill a good random number generator is to re-seed
it. No matter how good and random you think your plan to re-seed the
generator is you will _always_ screw up the randomness of the
generator. Please at least scan, if not read, Knuth before you
perpetrate multiple re-seedings on some poor random number algorithm.
-=-Dennis
.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
- Follow-Ups:
- Re: Dice
- From: Bill Briggs <email@hidden>
References: | |
| >Re:Dice (From: Kevin <email@hidden>) |
| >Re: Dice (From: Adrian Milliner <email@hidden>) |
| >Re: Dice (From: Robert Poland <email@hidden>) |
| >Re: Dice (From: Graff <email@hidden>) |
| >Re: Dice (From: Emmanuel <email@hidden>) |
| >Re: Dice (From: email@hidden) |