DEV Community

Sachin Sharma
Sachin Sharma

Posted on

How Computers Generate Random Numbers

Hey There..! I’m (AsliSachin) Back after a long break 😊. So today we’ll discuss How Computers Generate Random Numbers. So now without wasting much time let’s get right on the main content.

The Problem

Computers are specially and carefully programmed to eliminate randomness in results. They follow instructions blindly & are therefore completely predictable.

So, can computers generate truly random numbers?

Categorization

There are two categories of random numbers:

  • Pseudo-Random Number (PRN)
  • True Random Number (TRN) They have quite different characteristics.

PRN

Pseudo-Random Numbers are generated by using an algorithm so the results appear random, even though they aren’t.

For most applications, a Pseudo-Random Number is sufficient.

TRN

True Random numbers are generated by observing some outside data, like mouse movements of the fan noise, which is not predictable. The results might be slightly biased but they are not generated by a deterministic algorithm. Read More

Top comments (0)