quote:
what i dont understand is how it works, how is anything with a computer random? there must be some sort of code or whatever which decides the number, it cant just be plucked out of thin air... can it?
In most cases you are correct and the numbers are only pseudo-random. That is certainly true of standard random number functions of most programming languages.
However, it doesn't have to be so. Truly random numbers can be generated by specialized hardware (usually using Gaussian noise from a semiconductor junction). Intel motherboard chipsets, starting with i810 released in 1999, contain such hardware and provide a standartized interface to it.
The Intel hardware random number generator is supported by Linux kernel as entropy source for /dev/random and /dev/urandom devices. Most Linux applications use these devices to obtain random numbers, so they benefit from the hardware random number generation when running on machines using Intel chipsets, without the application programmers having to do anything special. These random numbers
are truly random.
It is also possible to build pretty good entropy by accumulating data like timing between keystrokes, mouse movements, and the durations of disk I/O requests. While not random in the strictest of senses, the sequence and timing of such events is virtually impossible to predict or reproduce, especially on modern multi-tasking systems running several apps at once.