Settings

Theme

Darts, Dice, and Coins: Sampling from a Discrete Distribution (2011)

keithschwarz.com

8 points by davikr a month ago · 3 comments

Reader

incognito124 21 days ago

This is good for sampling from a "static" distribution, which has stable p_i parameters, where you can armotize the alias preprocessing step.

If you have a distribution that changes from time to time, for example LLMs where you have a new discrete distribution for every step (N-dimensional dice roll), other methods are used. Recently I wrote a writeup comparing three methods (spoilers: simple is best):

https://news.ycombinator.com/item?id=42596716

Keyboard Shortcuts

j
Next item
k
Previous item
o / Enter
Open selected item
?
Show this help
Esc
Close modal / clear selection