Donald Knuth wrote:
John von Neumann wrote:
Anyone who considers arithmetical methods of producing random digits is, of course, in a state of sin. (1951)
The Art of Computer Programming, Vol II, Semi-Numerical Algorithms, Chapter Three, Random Numbers
"Random", that is, to say more accurately, semi-random numbers, are in fact produced arithmetically. This can actually be an asset in some cases, because when you start with a known seed value, you can precisely reproduce a sequence of known "random" values at will.
Typical random number generators typically case the values as integers, break the integer values into parts by purely mechanical means, then combine the parts according to a certain formula. If you do this properly, the granularity of the resulting pseudo-random value will be the granularity of the primitive type that you are working with.
Some random-number generators attempt to avoid this predictability by introducing external data into the mix. This can be as simple as a quick scan through sections of the computer's RAM known to be volatile and network traffic or as truly random as monitoring radioactive decay (beware of cat hair, though) or interstellar decay. Often these mechanisms also include a "switch" that you can flip so that for
testing purposes you get repeatable values while still being abot to obtain more truly random values when you need them.