On Minecraft, how is it possible that during a map creation, you can just scramble letters, numbers and symbols as a seed and still have a random map as a result?

633 viewsOtherTechnology

My real question is, how is it possible on programming context?

Like, typing “dioasdjklasdknlvioj3e40435905$%” randomly on the seed input, start the map and have a still totally randomly generated world.

And by that, i actually mean how can that be possible if Minecraft wasn’t complex to program, as far as i know.

EDIT: Forgot to add, there is also a more than a sixtillion (Or even far, far more) of character combinations (Incluiding quantity of characters). All of them, if you change a single character in any place, generates you a random map. The slightlest change, and your map is completely different.

Where i am going is… how is it possible that such a small game like Minecraft could have an infinite number of randomly generated maps if it just weights a few Gigabytes (Or even Megabytes) on your PC?

In: Technology

11 Answers

Anonymous 0 Comments

When computers do something “randomly,” it’s not usually actually random. Computers are designed to do the exact same thing every time you give them the same instructions, which means that, in principle, every time you tell them to make a choice, it will always choose the same thing. It’s possible to use special hardware to use physical processes to get “true” randomness, which is useful for things like gambling or high-stakes cryptography, but for everyday things like video games you usually use what’s called a pseudorandom number generator (PRNG)

a PRNG is a process that you use by putting one number in, and getting another number out (by some convoluted math going on behind the scenes). Typically, the next time you use the PRNG, you won’t give a new seed number, you’ll just use the last number it made to get another number, and then use that to get another, and so on. Computers always do the same thing every time, of course, so the same input number always gives the same sequence of outputs, but a well-designed PRNG makes it very hard to see the connection between the input and output numbers. If you set the initial input number unpredictably, for instance by using the current time, you get behavior that looks random to all but the most careful analyses.

An upside to this is that if you want processes that are both varied and repeatable, you can just set the seed to specific values. For instance, if you’re making a video game, you can just write a level generator that uses a PRNG to create a variety of different worlds, and then you let the user control the seed. I don’t know the details of minecraft’s world generation algorithm, but at least in principle seeds work “for free”: if you’re generating random maps, you’re going to be using a PRNG in some form or another anyway, so you might as well give the user control of the seed the PRNG uses rather than leaving it completely up to the time or whatever other seed value you’d use.

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