📜 ⬆️ ⬇️

The probability that 2 miners have the same world

Hello! Recently, I was interested in the question: “can it be that 2 players in Minecraft have the same single world?”

The fact is that the world of Minecraft is generated randomly from a given seed. It can be set manually or get a public pseudo-random. It is worth noting that the same seed generates the same seed.

This game is very popular, so it’s not possible to directly interview all the players and compare their single worlds. However, we can always calculate the probability of this event. It would seem: all that we need is to count the number of elementary outcomes that satisfy this event and divide it into the set of all elementary outcomes. Unfortunately, this is a very nontrivial task, so I remembered the “Paradox of birthdays”.

The paradox lies in the fact that in a group of 23 people the probability of a birthday is 50% with two people. Obviously, the task is similar to ours. How was it solved? Very simple: it turned out that it is much easier to calculate the probability that each person in the group has a unique birthday. To do this, take one person and remember his birthday, then take the second, and the probability that his day does not coincide with the first will be equal

$$ display $$ p_2 = 1- \ frac {1} {365} $$ display $$

Those. 100% minus the probability that their birthday is the same. We take the third and consider the probability that his birthday does not coincide with the previous two

$$ display $$ p_3 = 1- \ frac {2} {365} $$ display $$

And so on to the nth person

$$ display $$ p_n = \ frac {n-1} {365} $$ display $$

Then the probability that not a single person in the group matches

$$ display $$ p = 1 * (1- \ frac {1} {365}) * (1- \ frac {2} {365}) * ... * (1- \ frac {n-1} { 365}) $$ display $$

And the probability that at least 2 matches

$$ display $$ p_ {required} = 1-p $$ display $$


')
It remains only to apply this solution for our case. Minecraft has only 2 ^ 64 possible seeds, and about 200 million players. So our formula will look like

$$ display $$ p = 1 * (1- \ frac {1} {2 ^ {64}}) * (1- \ frac {2} {2 ^ {64}}) * ... * (1- \ frac {2 * 10 ^ 8} {2 ^ {64}}) $$ display $$

Manually, this is very time consuming, so I wrote a small program in Python 3 that did this for me.

image

If someone is interested - here is the program code, but it is very simple.

a = 2**64 n = 200000000 p = 1 for i in range(n): p *= (1 - i/a) print('Chance that 2 players of minecraft have the same seed: ' + str((1-p)*100) + '%') 


It turned out 0.1%, which, by the way, is quite a lot, considering the number of possible seeds.

Thanks for attention!

References:

Birthday paradox
How many people play Minecraft
How many seeds in Minecraft

Source: https://habr.com/ru/post/460629/


All Articles