how do “seeds” work in video games such as Minecraft?

1.13K viewsOtherTechnology

For example, how does an infinitely randomized world like Minecraft manage to generate me an identical world to my friend with just a handful of numbers that they send me?

In: Technology

23 Answers

Anonymous 0 Comments

Generally speaking, there’s no such thing as “random” when it comes to a computer. They are fully deterministic machines. If you write a fixed algorithm and give it a fixed input, it will always return the same output. If you do need a truly random number, then it always needs to be fetched from *outside* the computer in some way (say by measuring background noise, the movement of your mouse, the CPU’s temperature fluctuations, radioactive decay, or many other ways).

In applications that aren’t security critical, computers will often use numbers that are “pseudorandom”. That means you take a seed number – say the current time – and apply a bunch of mathematical calculations on it to get a series of new numbers. It’s important to note that they aren’t really random. If you know the initial value, you can always apply the same calculations to get the same output numbers every time.

Video games use this trick during world generation. You start from a single seed (which could be random or not) and then generate every subsequent “random” number from that seed. So, if you know the seed and the exact algorithm, the entire world can be duplicated.

You are viewing 1 out of 23 answers, click here to view all answers.