Why Random Numbers might not be Random Numbers

On Patterns and Randomness

Nuwan I. Senaratna
On Technology
2 min readOct 13, 2019

--

Do you remember the last time you got an SMS with a two-factor-authentication code from Gmail, or Facebook, or your bank?

Do you remember looking at the four or six digits thinking,

“Isn’t this supposed to be a random code? It doesn’t look very random to me”.

It happens to me all the time.

Applying the “scientific” method

So, I thought of investigating. By generating ten four-digit random codes, and checking if they were indeed “random”.

  • 4274: “42” is a multiple of “7”. Can’t be random!
  • 7608: This number has “6”, “7” and “8”. Can’t be random!
  • 2523: “23” followed by the next odd number “25”. Can’t be random!
  • 1983: My cousin’s wife’s husband’s grand-uncle’s year of birth! Can’t be random!
  • 5555: Four “5”s in a row. What are the chances of that happening? Can’t be random!
  • 2974: “9” — “7” = “2”. Can’t be random!
  • 4664: A palindrome! Can’t be random!
  • 8485: Consecutive numbers! Can’t be random!
  • 6656: Three “6”s. And “5”. Can’t be random!
  • 1994: The year CBK became president! Can’t be random.

Conclusion? No four-digit-code is random! We are certainly doomed! The apocalypse is nigh!

Not quite

What does it mean for some pattern to be “random”? It means that the chance of getting the said pattern is highly unlikely.

But how unlikely are the patterns we observed?

  • 4274: The chance of one two digit number being a multiple of one digit number is about 83%.
  • 7608: The chance of getting three digits that are consecutive is about 14%.
  • 1983: The chance of getting a 20th century birth year is about 1 in 90
  • 5555: The chance of getting 4 consecutive numbers is 1 in 1000

And so on.

While some patterns are unlikely, others are quite likely. For example, with ten codes, your almost never likely not to get a “one two digit number being a multiple of one digit number” like 4274. The chance of not getting such a number is about 1 in 50,000,000.

Even with unlikely patterns like “5555”, with so many codes, they are bound to turn up at some point. For example, if you have received a 100 codes, there is about a 10% chance, that you’ve received a code where all the numbers are the same.

The problem is not that random numbers are not random. But because we humans are over-sensitive to patterns.

So, all’s well!

Please continue to use two-factor-authentication!

--

--

Nuwan I. Senaratna
On Technology

I am a Computer Scientist and Musician by training. A writer with interests in Philosophy, Economics, Technology, Politics, Business, the Arts and Fiction.