This is a response to VC 30 Suzanne 8 ("Solitaire Science")...
Suzanne:
Your questions about random numbers and computer-shuffled decks touch some deep philosophical waters, but the basic answer requires only a bit of splashing through a nearby textbook.
First, what is a "random" number? A random number is, essentially, an unpredictable number and a random number generator is a device or method that produces a sequence of such numbers. The trick to being random in the strict mathematical sense, however, is that although any given random number should be unpredictable, the distribution of numbers across the specified range should be uniform.
Suppose you ask the computer to generate 1000 numbers between 0 and 9. What you want is a hundred or so zeroes and ABOUT a hundred ones and so forth in a non-obvious order. You don't want EXACTLY 100 of each digit because that wouldn't be "random." But if you wind up with, say 468 threes and hardly any fours something is wrong.
It turns out that computers cannot create true random numbers because a (normal) computer is a deterministic machine. That is, once you tell it to do something it always does exactly the same thing over and over. It is, however, possible for the computer to create "pseudo-random" numbers, numbers which appear to be random and which pass all sorts of statistical tests of randomness. Because a fixed method is used the numbers produced are entirely predictable IF you know the equations and variables used. But to the outer world, within certain limits, the numbers appear to be totally random and can be used like true random numbers.
There are all sorts of methods used to produce pseudo-random numbers and many books have been written on the subject. The most common method is called the Linear Congruential Method. It's very simple. Just take a number, any number will do, multiply it by a constant x, add 1, and take the remainder when divided by a second constant y. Then feed the resulting number back into the equation as many times as you like. The result is a stream of numbers between 0 and y-1.
One problem with these type of random number generators is that, depending on the constants and the initial "seed" value, they can sometimes fall into tight cycles which produce the same small set of numbers over and over again. There are all sorts of tricks to avoid this, like choosing a constant x one digit shorter than y and ending in j21 where j is an even digit. Strange, but true.
Once you have a solid random number generator that passes the basic statistical tests, it is a simple matter to use those numbers in a program to simulate the shuffling of a deck. As you and Paul have both suggested, it is possible to store a pre-determined set of random arrangements so that different people can play solitaire with decks shuffled into the same order.
If you archipelagoans continue to express such an interest I will arrange a solitaire CONTEST, with each Archipelagoan playing 100 games arranged so that each person sees the same random arrangement of cards.
|