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.
I think he meant how do computers actually calucate them, because computers run solely on the basis of linearity, so for one to calculate an actual random number would be impossible.
Deleted User
22nd July, 2005 at 15:48:09 -
I just had to since you all yell at me about stuff like this
" Hi!
I were just wondering... how does a computer compute a random number? that seems impossible to me."
Well, that depends on how the Motherboard chooses to generate one. Mine counts the number of electron running through pin 1 or something. It's wierd.
Craps, I'm an old man!
DaVince This fool just HAD to have a custom rating
Registered 04/09/2004
Points 7998
1st August, 2005 at 06:13:14 -
I think there was this guy who made a 600,000 bits random bits CD-ROM with a formula he created which creates truly random bits without any of that help.
At least, that's what I read in my maths book.
Old member (~2004-2007).
Deleted User
2nd August, 2005 at 00:07:49 -
wow 3 moth old topic still runnin but i have no clue how it does it...
DaVince This fool just HAD to have a custom rating
wait i thought of the one and only random thing in the world Creatures
their ideas are random and their features are random
Deleted User
5th August, 2005 at 21:17:58 -
Oh yeh because there is limitations to human thought like you cant picture a color that youve never seen... i wonder if there are any.....just try to imagen one... I cant well mabey thats because im dumb
Not really because there are limitations on human thought. It's because everything we do and think comes from an outside stimulus. Then you create other stimuli for yourself and other organisms to reply to. Every decision we make is basically pre-determined by our life experiences. We really have no choice in what we do in life. Nothing is truly random, everything is linier and there is only one possible future.
Unless there truly are minute particle we haven't discoved or don't understand whose movements are truly random.
I'm thinking too much.
Working On:
Psydude
Castle Wars(working title)
XBLGT: sunstrike9
Deleted User
6th August, 2005 at 00:10:03 -
Well thats whats fun thinking hard, well somtimes if its voentary. But I dont think there is only one future mabey there are many possibilitys but you will only thinkof doing like four different things in a situation then an infinuete ammount based on what you have seen and heard in you life so in my thoughts there is only a few billion different futures not 1 and not infinute but that probably didnt make any sence because when i try to explain my thought on somthing as complicated as the futer i usually dont make sence.
DaVince This fool just HAD to have a custom rating
Registered 04/09/2004
Points 7998
9th August, 2005 at 06:25:09 -
That random comment wasn't actually random, you know.
Perhaps one should give a definition of random, in order to make it useful for discussing.
Because things you know afterwards aren't so random anymore. But before, you couldn't predict what was going to happen.
O and for an easy implementation of random, just make a counter and make it loop (counter++) between your min and max value. And if you need a random number, just grab it.
Or use the Mersenne Twister.
Or create your own pseudo random generator.
'Hoy... I didn't think this would merit it's own thread; curious as it is, it serves little purpose.
So I'm posting it here.
I made a little program in MMF that would take an overlay object, paint it black, then, on the press of a button, fast-loop-draw 64 pixels at (random(640),random(480) with color (random(256),random(256),random(256).
And after a while, this pattern developed:
Fifth: something like that can be seen in the Mersenne Twister example. The Mersenne Twister object has a better randomizer.
<i."Unless there truly are minute particle we haven't discoved or don't understand whose movements are truly random."
Electrons move randomly in an atom.
couldnt you just do and static movement choose all 32 directions as possible to look to at the start of the frame then the direction would be completely random right?
Who said life was linear, was that just discovered and noone told me? As last I heard noone knows how to predict the movement of quantum forces, infact its very very chaotic. If fate exists, prove it.
Computers calculate 'random' numbers through various inputs. You're correct, computers aren't and most likely will never be random. Time, mouse, and various other inputs are used in calculation of 'random' numbers in a computer. If you aware of the input you can determine what number will be called, and it will no longer be random.
@Joachim: your
'10-random(10)'
example is the exact same as
'random(10)'
thinking is like pong, it's easy, but you miss sometimes.
DaVince This fool just HAD to have a custom rating
Registered 04/09/2004
Points 7998
22nd August, 2005 at 08:17:49 -
Except that the range is 0 to 10 instead of -10 to 0.
Most programs create more random randomness by comparing the internal clock and the processor. Some of them have used user inputs like the distance the mouse has moved or keyboard stuff, but the pros don't like it as some people aren't very random when typing and using a non-essential piece of hardware means that you can't generate random numbers if say, the keyboard or mouse isn't working.
It's impossible to get truly random numbers. One book on cryptography I read has a section on unbiasing biased coins (in the digital sense). There's plenty of people and thousands of dollars invested in creating pure randomness. Some very high-security programs actually combine several sources of randomness, just to make sure that if a cryptohacker manages to plant a keygen in one of the sources, there's still the others to make it random.
Technically nothing is random in real life. Every random thing is about which subatomic particles bounce into which. But the thing is, we're unable to predict how such subatomic particles would act and that's what creates randomness. Now if someone could find a way to control subatomic particle movement, I could probably create some keygen to get passwords for high-security organisations .
Disclaimer: Any sarcasm in my posts will not be mentioned as that would ruin the purpose. It is assumed that the reader is intelligent enough to tell the difference between what is sarcasm and what is not.