DEV Community

Discussion on: Explain the challenge of generating random numbers like I'm five

etienneburdet profile image
Etienne Burdet

Because we try very, very hard that the hardware does absolutely nothing randomly. You ask 1 its 1, you ask 0 its 0 (and you want that !). You cannot ask "0 or 1, I don't care".

So there is no source of randomness in your computer, something that would fluctuate without you knowing why. So you can try to make one and hide it. For example, if you tried to implant a random function from scratch, you could write a list of number in the wrong order [7, 6, 0, 9, 4, 3, 2, 5, 1, 8] and loop through it. It would seem random enough… until people ask 20 times and notice the pattern.

This very simplistic, but in essence that's the problem about randomness: hide the pattern. Patterns can get very, very sophisticated mathematicaly (like Nobel prize sophisticated). But the name of the game is always the same: as long as "you" (or a computer…) cannot guess the pattern, it's random. If you guess, even partially, then you can make prediction = it's not random anymore.