Papers › Maintaining Discrete Probability Distributions in Practice
Maintaining Discrete Probability Distributions in Practice
Daniel Allendorf
The archive published only this paper's code-link row. Authors, date and abstract are from arXiv's metadata (CC0), read from the Kaggle arXiv metadata snapshot of 2026-09-12 where its title matched the archive's; the title is the archive's.
A classical problem in random number generation is the sampling of elements from a given discrete distribution. Formally, given a set of indices S = {1, …, n} and sequence of weights w₁, …, wₙ ∈ℝ^+, the task is to provide samples from S with distribution p(i) = wᵢ / W where W = ∑ⱼ wⱼ. A commonly accepted solution is Walker's Alias Table, which allows for each sample to be drawn in constant time. However, some applications correspond to a dynamic setting, where elements are inserted or removed, or weights change over time. Here, the Alias Table is not efficient, as it needs to be re-built whenever the underlying distribution changes. In this paper, we engineer a simple data structure for maintaining discrete probability distributions in the dynamic setting. Construction of the data structure is possible in time O(n), sampling is possible in expected time O(1), and an update of size Δ can be processed in time O(Δn / W). As a special case, we maintain an urn containing W marbles of n colors where with each update O(W / n) marbles can be added or removed in O(1) time per update. To evaluate the efficiency of the data structure in practice we conduct an empirical study. The results suggest that the dynamic sampling performance is competitive with the static Alias Table. Compared to existing more complex dynamic solutions we obtain a sampling speed-up of up to half an order of magnitude.
Code
Repository list and official/mentioned flags are the archive's, frozen 2025-07-28. Reachability, where shown, is from one Syntology probe window (2026-09-16 to 2026-09-18); repositories not probed show nothing. GitHub stars are not tracked.
Code Syntology ran Syntology
Not run by Syntology. Nothing on this page verifies that the listed code works.
Results from the paper archive 2025-07-28
No leaderboard rows for this paper in the archive.
Report a problem or propose a change · a person checks every report against the paper or source before anything changes; decisions are listed on /corrections