Y
Hacker News
new
|
ask
|
show
|
jobs
by
chpatrick
699 days ago
Another nice one is O(1) weighted sampling (after O(n) preprocessing).
https://en.wikipedia.org/wiki/Alias_method