Main Content


Hypergeometric random numbers


R = hygernd(M,K,N)
R = hygernd(M,K,N,m,n,...)
R = hygernd(M,K,N,[m,n,...])


R = hygernd(M,K,N) generates random numbers from the hypergeometric distribution with corresponding size of the population, M, number of items with the desired characteristic in the population, K, and number of samples drawn, N. M, K, and N can be vectors, matrices, or multidimensional arrays that all have the same size, which is also the size of R. A scalar input for M, K, or N is expanded to a constant array with the same dimensions as the other inputs.

R = hygernd(M,K,N,m,n,...) or R = hygernd(M,K,N,[m,n,...]) generates an m-by-n-by-... array. The M, K, N parameters can each be scalars or arrays of the same size as R.


numbers = hygernd(1000,40,50)
numbers =

Extended Capabilities

Introduced before R2006a