3 ms·
Another nice one is O(1) weighted sampling (after O(n) preprocessing). https://en.wikipedia.org/wiki/Alias_method https://en.wikipedia.org/wiki/Alias_method
by chpatrick 2y ago
Another nice one is O(1) weighted sampling (after O(n) preprocessing).
https://en.wikipedia.org/wiki/Alias_method https://en.wikipedia.org/wiki/Alias_method