This is a probability problem I encountered today.
What algorithm or equation solves the situation below generically?
There is an unlimited supply of playing cards.
There are 10 spots on the table to place cards.
A card is picked at random, and placed on a random spot on the table. The new card will replace any previous card that may have been on that spot.
This is repeated 5 times.
What is the probability that a there is an ace on any of the 10 spots?
A generic solution requires three variables:
- V (values) = 13 card ranks
- P (positions) = 10 available spots
- R (repetitions) = 5 repetitions
I hope the card explanation is relatable. However, my specific situation is related to game development:
I fill a chest with randomly chosen loot in randomly chosen inventory positions, and I would like to get a formula to determine the chance of any particular item appearing in the chest at the end.
There is a group of V values to choose from. The values are replaced when picked, so this group never changes.
There are P empty positions to place them. Every time a value is chosen from the group, it is placed in one of the P positions, chosen at random. If a value was already placed in the same position before, the new value replaces it.
This is repeated R times.
What is the probability that a particular V value remains chosen at the end?
V=29; P=27; R=8, I analytically got a probability of
However, I would like to achieve an exact value with any set of parameters.