This paper presents and proves the statistical formulae that give the
expected number of distinct values when selecting from a bag(urn,box) without replacement,
and validates them using brute-force.
Java and PL/SQL implementations are provided as well.
The supporting material is here.