A common approach is to use the internal system clock and perform an unlikely function on it - because it's constantly changing, this gives the appearance of true randomness. Another approach is to use a random seed number, which always generates the same sequence of numbers (possible using the MMF "Randomize" action).
You're right that it is impossible for a computer to generate true random numbers, because the whole point of computers is that they're entirely deterministic and predictable. The only way to get a computer to generate a truly random number is to use some external input as a source - one method I read about was using the distance the mouse has moved as a seed. www.random.org goes so far as to use radio noise to generate a random number.
I believe they use radioactive sources for random numbers too - or leave the lens cap on a webcam (same idea as radio waves).
The time is usually the seed for the random function. They're designed to give large changes in output with small increments in seed in order to appear more random (because time constantly increments). If you really want to know download the source for the Mersenne Twister algorithm - not used by C or most languages, but it is built into PHP, and infinitely better than the default functions.
n/a
Assault Andy Administrator
I make other people create vaporware
Registered 29/07/2002
Points 5686
15th May, 2005 at 08:16:08 -
One way the random seed is picked is sometimes when you open a game and there is a "press start" menu. The time between the start of the app and when you press start is the seed.
since we're talking physics, isn't the entire universe deterministic? That means that nothing in the universe can be random. What a pain.
"Say you're hanging from a huge cliff at the top of mt. everest and a guy comes along and says he'll save you, and proceeds to throw religious pamphlets at you while simultaniously giving a sermon." - Dustin G
even we aren't randomistic, every thought you think is just an electric pulse that goes through you brain and stuff. Urrrghh.... it feels crap to be so predictable
I don't know where you're getting that from. The behaviour of any particle is random within a certain probablity spread (well, actually they can do anything but the probability is asymptotic outside what's likely). So everything is random on a subatomic scale.
I forgot what caused radiation, but isn't that random?
and, er, when you get a degree in particle physics, make us a massive universe to store information about every particle in the universe so we can make time machines and shit
If you're wondering how to get a random number in one of your games, I know how (MMF)
I you want to have a random number between 1-10 do like this... You have a counter and for example "at start of frame" set counter to 10 - random (10). And the counter is set to 10 minus a random number between 1-10.