Generate discrete random variates from a set of dynamically weighted elements in Solidity using a forest of trees data structure, based on a novel algorithm laid out in a paper found in the esoteric footnotes of Knuth. Runs in iterative log time for on-chain use cases.
https://valorem.xyz/blog/building-a-dynamically-weighted-random-variate-generator-eth-denver/