Originally posted by LordZpider anyone know how something that suppose to take commands and act on those commands, a computer, GENERATE a random numbers?
anyone know how something that is suppose to take commands and act on those commands, ie a computer, GENERATE a sequence of random numbers?
i think he's asking how something with a set formula and set parameters can prduce something completely random. Well, to the best of my knowlege, its not completely random. there are set parameters(orguidlines i guess u could say) and them a value or figure is selected within those parameters. sort of like rolling a pair of dice, you can never go higher than 12 or lower than 2, but anything in between is random. in a way its still controlled though, because you have to tell yourself to roll the dice.
I hope that was a good analogy, and i hope i was correct and helped you out.
What i'm trying to say is simply, how do computers generate random numbers?
and i know there are set parameters. but for example, i tell me calculator de create random intergers, and it just start spitting out random numbers, no patterns... just RANDOM... where do these numbers come from?!
C. M. Ngan
Aerospace Engineering
University of Illinois at Urbana Champaign
Last edited by LordZpider; 2002-11-10 at 11:50 AM.
Originally posted by LordZpider What i'm trying to say is simply, how do computers generate random numbers?
and i know there are set parameters. but for example, i tell me calculator de create random intergers, and it just start spitting out random numbers, no patterns... just RANDOM... where do these numbers come from?!
They actually come from a formula that's fed from a small clock. That way, the number doesn't stay the same and is random enough for your purposes.
that says nothing, the command is telling C++ to generate a random number, but not actually calculating one.
let's say,
printf ("A number between 0 and 99: %d\n", rand()%100);
and the ouput is 46
where did that 46 come from? no one seems to understand my question. But i think i should have just left it alone after the small clock theory, cuz that's probably as accurate as it will get
C. M. Ngan
Aerospace Engineering
University of Illinois at Urbana Champaign
IIRC Linux has a random number generator proccess that is accessed by other programs. Also, you can get open source standard libraries for at least the Linux platform, which should either include a random number generator, or a call to the afforementioned.
I know it's a process that has to be seeded... if you use the same seed number, you'll keep getting the same "random" numbers in a sequence. You're right, it's usually the number of seconds elapsed since midnight that's used as the seed number.
They still won't be generated at the exact same time. A computer cannot do that. It still only processes a single 1 or 0 at a given time.
The time when it reaches the second number will be slightly different, probably enough to make it different. However, if you had two comps running simultaneously at the exact same time, you could get the same number.