Playing poker… I recall reading somewhere that computers cannot actually generate truly random cards. I can’t remember the arcane reasons why that is, but I do remember that it is.
My very shallow understanding is that computers are algorithmically deterministic in nature, meaning you would always get the same output for the same input (barring hardware/environmental/electrical anomalies). The best they can do, as far as I know, is a “pseudorandom” number… you give it a starting “seed” value and it spits out this other mysterious number based on that. At first glance that isn’t random at all, but consider that a typical seed can come from anything from the current time (down to some tiny fraction of a second) to your particular typing and mousing habits, which taken together is “random enough” for most cases.
For a better explanation, I’m sure a mathematician or computer person will come in soon enough…
Firstly, there is specialized hardware to make it possible, essentially using sensors to pick up information about the world around the computer – presuming that the world is a random place.
Minus that hardware, then no a computer can’t generate a truly random number. Think of a computer as a sequence of gears. You turn a crank and each gear turns the gear it is connected to by a finite, predetermined amount. You can make the gearing sufficiently complex that the direction and amount that a particular gear will move with each crank of the shaft appears random, but in truth it’s predetermined. Someone with the exact same machine, started in the same position, will have the same result come out with each crank.
Just to close the circle. As described above - all computational random number generators are pseudo - and indeed - given the same starting conditions will always create exactly the same sequence of numbers. In principle, if you knew the algorithm used, and had sufficient computational power, you would be able to watch the output of a pseudo-random number generator for a few generations and then be able to predict every number it created after that.
True random numbers are hard to generate at the best of times. Electronic systems (which could be used in a computer) typically try to use some sort of noise source. There is devil in the details here, and often the quality of randomness (the entropy) is not as good as you might hope.
There are programs that try to get a reasonably high entropy from a standard computer. There are passably non-deterministic elements at work in a computer. Grabbing a set of current operating parameters such as the low order bits of the system clock, timing a few things like disk accesses (that are interfered with by the current operating system activity) and the like can build up a reasonable amount of entropy. Even then, if you do it often on the same computer you will probably start to see correlations in the numbers and their value drops. If a human input is needed to activate the generator the random element of time will mean that the low order bits of the system clock will have a pretty good amount of entropy. (Imagine using a stop watch as a dice throw. Start the clock running, and then stop it some time in the future. Use the tenths of a second as the value of the throw. The clock clearly isn’t random, but your ability to control the actual number is so poor that the final number is pretty close to perfectly random. Same idea for using a computer clock. It just runs a heck of a lot faster.)
The simplest answer is: because computers have no imagination.
I’m not being snarky. That’s the real answer. Given that computers have no imagination, they need a set of instructions as to how to pick a random number (or in your example, a random set of playing cards).
One set of instructions might be something like this:[ol]
[li]Look at the exact time right now.[/li][li]Calculate how many seconds it has been since midnight.[/li][li]Look up “pi” to that many decimal places, and take the next three digits.[/li][li]You now have a random three-digit number.[/li][li]Use that number to count through an orderly deck of cards, and that card is the first one to deal.[/li][li]Repeat the above to find the second card to deal.[/li][li]Repeat the above as needed.[/li][/ol]The problem with the above is that the computer APPEARS to have chosen a random card from the deck, but if you turn the computer on at the exact same time tomorrow, you’ll get the exact same cards.
Of course, this all depends on your definition of “random.” And your definition of “good enough.”
At this point, computers are better than humans at coming up with strings of random numbers.
It’s difficult coming up with good algorithms for pseudo-random numbers, because the things a programmer considers random might not be. For example, you decide that the current number of bytes of disk space in use on the main drive is a good random factor. You pull out the lowest X bits of that number and multiple it by the millisecond value on the system clock. Oops. Disk space is allocated in blocks and the lowest X bits will always be the same!
Pseudorandom numbers are good enough for many applications. If you want better you can buy RNG hardware or use software that makes use of your existing hardware for better randomization (asks you to press keys on keyboard, samples your wifi card, makes you move your mouse, etc).
I know there’s been some talk from a few of the CPU manufacturers about putting the hardware for random number generation in their new designs, but has that gone anywhere?
It’s also worth mentioning that when you’re doing simulations, pseudorandom numbers are actually better in some contexts than true random numbers. For example, it’s often useful to be able to recreate the behavior of a system on “random” input to see where something went wrong.
This reminds me of the password threads going around and, in reference to Wombat’s comment, one’s definition of “good enough.” As an IT security guy, I once got into a “discussion” (euphemism…) of whether using a random password generator was sufficient. On the one hand, it’s a solid protection from dictionary attacks (assuming the output doesn’t end up being an actual word) but, on the other hand, it’s not truly random.
A good example of the lack of true randomocisity (I word that I clearly made up) is those little keychain tokens people use to access corporate VPNs. Contrary to vendor claims, they are ALL (all is perhaps too strong a word, but…) vulnerable to timing attacks because they are time-based, synching the token to the clock on the central server via an algorithmic function. You can, indeed, predict what that magic 6-digit sequence will be. Not easy without some hefty footwork, but certainly possible.
I used to think so, too, until I saw some of the answers my students gave for homework problems.
Another use for pseudo-random numbers is in some games. For instance, if you start up FreeCell, it’ll tell you up top that this is puzzle #53298 that you’re working on, and if you say to someone else on another computer “Man, puzzle 53298 is a tough one!”, they can bring it up on their computer and look at the exact same deal as you. When Microsoft created FreeCell, they didn’t sit down and create a list of 65,536 different deck orders; rather, the puzzle number is just the seed that’s fed into the pseudo-random card shuffler.
Ah - this explains something - when I was initializing my Blackberry at work and installing the VPN security on it the software forced me to move my mouse about for 5 seconds or something - and I was wondering what the heck that was all about. Now I know, it seems.
Thank you, this is the closest thing to actual clarity of all the posts. (I am very smart in some areas, very not so smart in others…mathysciency stuff is a struggle for me in most respects. )
It makes sense to me because it’s actually kind of similar to my own attempts to create a random effect - at least it seems so to me: it’s reminiscent of the way I explore my bizarrely vast collection of MP3s (70,000 or so): make a smart play list that, for instance, selects 25 of the least played songs that have the letters “ea” in the album title and were added before March 3, 2009.
Whilst computers are far from perfect at creating random number sequences they are still far better than humans. When I was at university we had to write a small program to predict the next term in a sequence. In this case it was heads vs. tails, all the students in the class made a list as random as they could (e.g. HHTHTTH etc.) and these lists were used to test your program. When fed with human input my program was around 70% accurate, when fed with a computer generated input it fell to near enough 50%.
Of course, in the same way that a computer can’t generate a random number, nothing else can either…if you look at it with enough computational power. Sure, if any of us throw a balanced die, or cut to a single card in a well-shuffled pack, it’s random to us…but not to the universe.
If you toss a die, the outcome is written before it leaves your hand. If you could see the angle it dropped at, the orientation of the die, the force you chuck it at, the drag of the table as it slides, you could predict it every time. Even if you have a friend who’s gonna bop it to change it up a little bit, the how and when are written in electric fire in his head before he does, and that can be accounted for too.
With enough knowledge, you can know how the atoms will bounce off of each other, making nothing truly random. Everything can be traced back, cause to cause, to the beginning.
And that’s why I don’t mind my D&D players using a die roller program. It’s all written anyway.
Well, I’m no fancy schmancy quantum wormhole theorist guy, but the way I see it…even if we don’t understand the rules, even if we never do, the rules are still there. The universe knows what will happen, because…well, it’s how all the parts interact, how the gears mesh. So, with enough knowledge, even when you get into stuff from quantums, it’s still not random. It was still written in the big bang (some scientists say).
Amusingly, it looks like the Windows version has a glitch which makes it solvable. Basically, you can re-start the game and then use “undo” to undo a move you never (in the restarted game) made, thus effectively making an illegal move.
There are actually theorems that address this, and if the information really is there somehow, that information can be transmitted across space faster than c, and even backwards in time. If you’d prefer a model without FTL or time-reversed communication, then you’re forced to conclude that what goes on in quantum mechanics really is random.
http://www.random.org/ is a website professing to generate truly random numbers (based on local environmental noise). I don’t think mathematicians would call it truly ‘random’, but it’s not a bad place to generate random numbers for most everyday purposes.