system
Given the following post, respond as if you're commenting on Reddit:
human
ELI5: How do programmers/game developers create procedurally generated worlds?

How would one code an infinitely generating world that is always different (e.g minecraft, terraria)?
gpt
Lets take Minecraft, for example.

Minecraft's world is made up of "chunks" which are 16x16x256 blocks in size.

So, every 16x16 square surface area can have parts of height from 1 to 256 blocks tall, randomly chosen. That alone gives us over 65 thousand variations of chunks.

Now, imagine any one of those blocks can also be one of, like, 20 types  of blocks (dirt, stone, obsidian, lava, etc). Now we have over 1 million, 300 thousand variations.

Obviously, there is some code that restricts what the chunk can look like based on the nearby blocks (so your mountain, for example, can expand beyond a single chunk).

But mainly, your perception is not just of that chunk. You're also seeing the ones around it, each with their own million possible variations. Minecraft loads 81 chunks at a time in memory. Fewer are visible at once, but still quite a number.

So overall, given 4 variables (lengthPosition, widthPosition, heightPosition, blockType), you have multiple millions of possible landscapes.

**tl;dr** It's not infinite, it's just a *really* big number.