Algorithm - Game item drop probability

475 Views Asked by At

My math knowledge is very limited but I came across a problem that requires some serious understanding of probabilities.

That being said, I have a game which has a box and allows customizing the drop chances of items inside that box on the following manner:

Bmin = Minimum items in Box

Bmax = Maximum items in Box

Bitems = [ I1 ... In]

Bchances = [ C1 ... Cn]

Note: ∑ Bchances has to equal 100


The game will then RNG a Bset between Bmin and Bmax, and after that will start cycling through Bitems, by order, performing an % RNG on that item's C to decide if its picked. The cycle will keep looping until Bset items have been picked. But once an item has been picked it can't be picked again (no repetitions).

This is all fine and dandy, but what I wish to accomplish is an algorithm that given any Bmin, Bmax and Bchances will allow me to calculate P(Ix) (Probability that item x will be inside the box).

The idea is to generate a Pitems = [P(I1) ... P(In)]

As I previously mentioned, my math background is very poor and when I tried to accomplish this through simple Combinations and basic Probabilities all I came up with was an algorithm with exponential complexity as Bmax and/or n increased (too embarrassed to even mention).

My question is if there is any way of accomplishing this through math, either accurately or within small margin of error, without exponential complexity.


Thank you

*RNG: Random Number Generator

Edit: Since it seems I wasn't able to clarify the problem properly, maybe this will serve as a 1000 words:

Imgur