I need to make a program which satisfies the below (my question is not about code):
The Balls’n Bins-problem deals with the experiment of randomly distributing a number of balls into an equal number of bins and trying to figure out how many balls there should be room for in each bin in order to avoid overflow with very high probability.
So I need to:
- Have N balls
- Have the same amount of bins as balls, so same as N
- Figure out how much room there should be in each bin to avoid overflow
- Each ball is distributed randomly in a bin
The thing I don't get is, shouldn't the size of all bins just be the same as amount of balls, which means you will never get overflow? If we got 10 balls, we just make all bins 10 in size?
Example:
What is the maximum number of balls in a bin if 10,007 balls are randomly distributed in an equal number of bins? You may wish to calculate an average and a maximum value over several experiments.
The correct answer (for this exercise) is to just find the bin with the highest amount of balls, repeat the experiment N times (like one thousand times) and get the average of the one thousand highest numbers.