function H=hypergeo(N, n, K, k) % hypergeo(N, n, K, k) hypergeometric - keno and lotto problems % N - Total number of choices % n - Number of choices picked as "good" % K - Number of choices you make % k - Number of "good" choices you actually make if max(n>N)==1 error('n cannot be > N') end if max(k>K)==1 error('k cannot be > K') end if max(k>n)==1 error('k cannot be > n') end if max(K>N)==1 error('K cannot be > N') end if max((K-k)>(N-n))==1 error('K-k cannot be > N-n') end H=(cmb(n, k).*cmb(N-n, K-k));