There is no way for a computer to generate a genuinely random number; instead, the aforementioned table can be used, or a seed number can be fed to a pseudo-random number generating algorithm, which can fake the randomness with some success.
However, as the number is not genuinely random, it is possible to affect the outcome of events that are supposed to be unpredictable given certain situations. Called 'luck manipulation,' this is a key feature of tool-assisted speedruns, recordings of games played with emulators, in slow-motion, frame-by-frame if necessary, with any non-optimally played sections re-recorded. Generally, the number generated is based partially on the timing and buttons pressed at any given moment, which means by pressing buttons that don't normally affect the gameplay, you can affect the 'random' numbers and, as an example, get a specific piece you need in Tetris. Of course, this is virtually impossible to do effectively unless you can re-play any section of the game at your discretion, with only minor changes in the controller input.
There is a growing rate of adoption for a specific pseudo-random algorithm called the 'Mersenne Twister,' which takes a very long time to repeat, has excellent number distribution, and is fairly inexpensive processor-wise. The author is quick to point out, though, that it is not suitable for encryption; it is possible to extrapolate the next numbers in a sequence with sufficient observation and analysis.
The only genuinely random number generator widely implemented in a home computer was for the Commodore 64, which could output static on the audio chip and pull a value from that.