Ask An Engineer

Can a computer generate a truly random number?

It depends what you mean by random…

By Jason M. Rubin

“One thing that traditional computer systems aren’t good at is coin flipping,” says Steve Ward, Professor of Computer Science and Engineering at MIT’s Computer Science and Artificial Intelligence Laboratory. “They’re deterministic, which means that if you ask the same question you’ll get the same answer every time. In fact, such machines are specifically and carefully programmed to eliminate randomness in results. They do this by following rules and relying on algorithms when they compute.”

You can program a machine to generate what can be called “random” numbers, but the machine is always at the mercy of its programming. “On a completely deterministic machine you can’t generate anything you could really call a random sequence of numbers,” says Ward, “because the machine is following the same algorithm to generate them. Typically, that means it starts with a common ‘seed’ number and then follows a pattern.” The results may be sufficiently complex to make the pattern difficult to identify, but because it is ruled by a carefully defined and consistently repeated algorithm, the numbers it produces are not truly random. “They are what we call ‘pseudo-random’ numbers,” Ward says.

For most applications, a pseudo-random number is sufficient, he adds. “For example, if you want to do a random sampling of a large set of data, you’ll need numbers to feed into the program so that the samples are more or less evenly distributed. Using pseudo-random numbers is perfectly acceptable in this case because there’s no quantitative advantage in the degree of randomness.” Similarly, a CD player in “random” mode is probably really playing in pseudo-random mode, with a pattern that is discernible if you listen carefully enough.

Not all randomness is pseudo, however, says Ward. There are ways that machines can generate truly random numbers. And the importance of true randomness is not to be underestimated, he adds. “If you go to an online poker site, for example, and you know the algorithm and seed, you can write a program that will predict the cards that are going to be dealt.” Truly random numbers make such reverse engineering impossible, he adds. There are devices that generate numbers that claim to be truly random. They rely on unpredictable processes like thermal or atmospheric noise rather than human-defined patterns. The results might still be slightly biased towards higher numbers or even numbers, but they’re not generated by a deterministic algorithm. (A similar online solution is available at

Thanks to Akash Jain, 17, from London, England, for this question.

Submit A Question

content Link link