in reply to Re: Check randomly generated numbers have not been used before
in thread Check randomly generated numbers have not been used before
the odds for no collision are easily calculated:
> perl -e ' $x=1; $x*=(1e7-$_)/1e7 for 1..3723; print $x ' 0.499919268547978
So the odds of a collision is already bigger than 50% after 3723 draws!¹
Actually there are already combinatorial formulas that avoids the loop completely.
For the interested readers:
Cheers Rolf
(addicted to the Perl Programming Language)
¹) and bigger than 99% after 9600 draws!
²) which many of us should have encountered at school already ... :-/
|
|---|