Welcome to the Harris Geospatial product documentation center. Here you will find reference guides, help documents, and product libraries.

  >  Docs Center  >  IDL Reference  >  Advanced Math and Stats  >  IMSL_RAND_GEN_DISCR




The IMSL_RAND_GEN_DISCR function generates pseudorandom numbers from a general discrete distribution using an alias method or optionally a table lookup method.

IMSL_RAND_GEN_DISCR generates pseudorandom numbers from a discrete distribution with probability function given in the vector probs; that is:

Pr(X = i) = pj

for i = imin, imin + 1, ..., imin + nm – 1


j = i – imin + 1, pj = probs(j), imin = imin, and nm = nmass

The algorithm is the alias method, due to Walker (1974), with modifications suggested by Kronmal and Peterson (1979).

If the keyword Table is used, IMSL_RAND_GEN_DISCR generates pseudorandom deviates from a discrete distribution, using the table probs, which contains the cumulative probabilities of the distribution and, possibly, indexes to speed the search of the table. IMSL_DISCR_TABLE can be used to set up the table probs. IMSL_RAND_GEN_DISCR uses the inverse CDF method to generate the variates.

© 2018 Harris Geospatial Solutions, Inc. |  Legal
My Account    |    Store    |    Contact Us