How many possible outcomes will there be to my Minecraft lock?
I just built a lock for a door in Minecraft. The user has to pick the correct four colors out of twelve. Order doesn't matter. What is the probability of the user guessing the correct colors?
Solution 1:
You have 4/12 of a chance of picking the first colour right.
You have 3/11 of a chance of picking the second colour right from the remaining eleven colours, if you got the first right.
You have 2/10 of a chance of picking the third colour right from the remaining ten colours, if you got the former two colours right.
You have 1/9 of a chance of picking the fourth colour right from the remaining nine colours, if you got the former three colours right.
Hence, the probability of guessing the combination is: 4/12 × 3/11 × 2/10 × 1/9 = 495-1.
In other words, there are 495 different combinations, of which one is correct.
Obviously, all of this is useless, unless you are working on a exploration mode map. It's much faster to just take a pick and destroy your door.
Solution 2:
Use the Choose function. You have 12 items, from which you can choose 4 and the order of those chosen 4 does not matter. This means you want to calculate 12 choose 4.
n choose k = n! / (k! * (n - k)!)
So, you have 12!/(4!8!) = 495 different choices, giving you a probability of choosing the one correct answer 1/495 = .00202... = 0.2%
Maths.