Question to the Probability Calculator Unittest

Hello, I just need a clarification, I’m hesitant if my code is right or wrong. There is that in the third test that the value of num_balls_drawn is 20, however, the total number of balls passed in to the hat was only 19. The result is 1, I get it if I reduce the num_balls_drawn to 19, an error if not. I wonder if it is supposed to be 20 or somewhat an error.

Plus, I don’t quite understand what does it mean in the README.md, in the instructions for the draw method, the “If the number of balls to draw exceeds the available quantity, return all the balls”. What does it mean? Does it mean that every draw(experiment run), as long as there is to draw, the contents of the hat does not change? If that is that, then wouldn’t the probability be affected? (as every experiment run would cater a different probabilistic outcome, and taking the average is not the appropriate way to approximate the probability.)

Or… the experiment should run actually like this:

There is a pool of balls in the hat, then a target kind of balls, then a number of balls to draw, and a number to repeat the experiment.

Every run of the experiment, the pool of balls in the hat will be the same???

Please, enlighten me, beautiful people.

if the number of balls to draw is 8, but there are only 6 balls, you can just return all balls

So… draw the first 6 and then return all the balls then draw another two?

no, the extracted balls are removed from the hat, also all at thr same time it seems from description

if the number of balls to draw exceeds the available quantity, I can basically skip the experiment and return the answer as 1?

i think it means if you’re required 8, you return 8 but if your content only has 5, return that 5

1 Like