If you fail to find a suitable library, this might help.
In reply to Re: Hypergeometric Distribution by BrowserUk in thread Hypergeometric Distribution by Anonymous Monk