Dynamic generation of discrete random variates

Yossi Matias*, Jeffrey Scott Vitter, Wen Chun Ni

*Corresponding author for this work

Research output: Contribution to conferencePaperpeer-review

18 Scopus citations


We present and analyze efficient new algorithms for generating a random variate distributed according to a dynamically changing set of weights. The base version of each algorithm generates the discrete random variate in O(log* N) expected time and updates a weight in O(2log* N) expected time in the worst case. We then show how to reduce the update time to O(log* N) amortized expected time. The algorithms are simple, practical, and easy to implement. We show how to apply our techniques to a recent algorithm of Hagerup, Mehlhorn, and Munro in order to obtain an expected constant time in the worst case for generation and update, with no assumptions about the input being made. We give parallel algorithms for parallel generation and update having optimal processors × time product. We also give an efficient dynamic algorithm for maintaining ε-heaps of elements; each query is required to return an element whose value is within an ε factor of the maximal element value. For ε = 1/polylog(n), each query, insertion, or deletion takes O(log log log n) time, with high probability.

Original languageEnglish
Number of pages10
StatePublished - 1993
Externally publishedYes
EventProceedings of the Fourth Annual ACM-SIAM Symposium on Discrete Algorithms - Austin, TX, USA
Duration: 25 Jan 199327 Jan 1993


ConferenceProceedings of the Fourth Annual ACM-SIAM Symposium on Discrete Algorithms
CityAustin, TX, USA


Dive into the research topics of 'Dynamic generation of discrete random variates'. Together they form a unique fingerprint.

Cite this