Let's say I have a lottery where each player chooses 6 unique balls.
There are 5000 players.
How do I choose the number of balls so that there's a ~95% probability of winning???
I can do this by using the following function:
function getRange(int nEntries){
int nBalls=6;
while(nCr(nBalls,6)<nEntries){
nBalls=nBalls+1;
}
return nBalls;
}
, however this is searching rather than working it out ;( I would like to make this function more efficient as I'm on a very constrained computer and this function will be called a lot.