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

1.16K 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

A very similar question was asked [two months ago](https://www.reddit.com/r/explainlikeimfive/comments/1bb25qf/comment/ku70q1z/), and once again most people are giving the wrong answer. Minecraft worlds are NOT randomly generated. They’re procedurally generated from a (pseudo) random starting point, the seed.

Here’s a copy and paste of part of my answer to the other post:

How does a seed get turned into a world? Well, I don’t know the exact method Minecraft uses, but imagine a simplified version where you take a deck of cards and use it to create a map grid. Take two factory fresh decks, all the cards in the same order. If you lay them out in a grid the same way, you’ll end up with two identical “maps”. Shuffle one deck, then lay the grid out again, and you’ll get a random map. Copy the shuffled order to the second deck, and follow the procedure of laying out the cards, and you’ll get the same “random” map.

The card order is analogous to the seed number. Input the number, put it through a mathematical procedure, and it turns out a consistent result. Laying cards out in a grid is a simple mathematical procedure, but you could also do more complicated procedures. To continue the card map analogy, say that every four cards you not only put down the card, but also put a poker chip on the card, of a value determined by the surrounding cards, and then used the resulting poker chip values to put down pretzels at corresponding places in the grid, and then added up the value of each row of cards and… You could make the procedure as complicated as you want, but as long as you follow the procedure it will result in the same map for any given seed, while still having a huge number of possible maps because of how many different orders the cards can start in.

Whatever mathematical procedures Minecraft is applying to the seed are lot more complicated, but the same general principle applies. If you perform the same math on the same starting number, you’ll get the same results.

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