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):
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
Ah my domain changed in the meantime, this is the correct URL:
https://terra-incognita.blog/posts/9