and it rekindled a question I should have asked in my C++ class but I was wonder just how someone goes about programming a computer to come up with a truly random number? I’m not looking for code here just the idea?
The only way for a computer to end up with a truly random number, is to get a starting number from elsewhere. For this reason, some random number generators (e.g., encryption programs) will ask you to move the mouse or randomly tap the keys before starting an algorithm. The string of information is transformed (or rather, not transformed, but I’m not splitting hairs) into a sequence of numbers which is used as the starting number for an algorithm.
The random numbers generated by computers are often called “pseudorandom” because, technically speaking, they’re not “true random”. Essentially because they will always produce them by taking an initial seed value, performing an algorithm on it to alter it, and producing a “random” value as the end result.
So the thing is, if you know exactly what algorithm it uses and know the seed value, you know what the result’s going to be–thus, not random.
Practically speaking, though, tricks can be done to make that seed value very hard to figure out, and conceivably impossible to I suppose. An idea I’ve heard in a similar discussion elsewhere would be to take as a seed value the current effect of background radio noise on, say, the sound card’s mike jack. The result is still pseudorandom, but that distinction’s only academic as the seed value comes from so many factors that it’s psuedorandom only in the sense of the proverbial butterfly-causing-a-hurricane sense.
You kids and your lava lamps! Why, when I was a boy, if we needed a random number, we rolled dice! They only had six sides, and we were glad to have them! Hmmph.
Okay, we had lava lamps too, but we just looked at them.