Fang Talks

Stella the sheep!

How can computers generate random numbers when all they understand is pure logic?

Generating truly random numbers (or other data) is a… difficult problem, to make an understatement. There isn’t much in the universe that is truly random, if there’s even anything at all. The closest we come is pulling values from hard-to-predict sources like the atmospheric noise RANDOM.ORG uses. And that’s pretty neat, but they lack something the (less random) computer-generated sequences do have. Reproducibility.

It may be strange to think of a bunch of random digits as something to repeat, but it can actually be quite useful. You may have heard of a “seed” in the context of randomness. The seed is the initial value the computer uses to base the rest of the sequence off. Setting a seed and requesting the first ten random numbers will get you the same numbers every single time if you use the same seed. This is how, even in games with randomly generated environments, those worlds can be sent to other players by only a single phrase or string: once the computer knows where to start, the rest is all logic.

That’s not my use case though, I just wanted random colors that didn’t follow the same sequence every time. The thing I run my code on doesn’t have an ever-updating internal clock, so I can’t use the correct time as a seed (which is very commonly done to get a unique random sequence). I had to jump through all kinds of hoops to get a somewhat random seed from which to sprout my sequence.

Logic is nice, except when you want thing to be less logical.
~ Fang

Comments

  • 02/11/2015 (1:09 AM)

    And here I just thought random numbers were truly random when generated by a computer. Nothing is random. Everything is intentional. The Matrix is real. I need to sit down.

  • 30/10/2015 (11:49 AM)

    Honestly some of this went over my head. But I do find it interesting that games like Minecraft have randomly generated worlds but you can make a specific one using a seed. Even when humans pick random numbers it’s not that random. If you ask someone to pick a number between 1 and 4 most people pick 3. It’s a simple little magicians trick.

Post a comment

Your email will stay hidden, required field are marked with a *.

Experimental anti-spam. You only have to do this once. (Hint: it's "Fang")