I was randomly thinking about loot/drop table implementations in games and naturally started thinking of the fastest way to implement large drop tables.
gpt5 pointed me to this fascinating algorithm that is barely mentioned online, but it can turn sample any discrete probability distribution in O(1)
https://y7k4.github.io/2021/03/23/alias-method.html
its a bit brain bending and it took a good 20 minutes of staring to understand how it works, but its pretty cool.
#nerdsnipe
gpt5 pointed me to this fascinating algorithm that is barely mentioned online, but it can turn sample any discrete probability distribution in O(1)
https://y7k4.github.io/2021/03/23/alias-method.html
its a bit brain bending and it took a good 20 minutes of staring to understand how it works, but its pretty cool.
#nerdsnipe
63โค๏ธ7๐2๐2๐ค2โฅ๏ธ1๐ฒ1