/LibDDRV

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.

Primary LanguageSolidityMIT LicenseMIT

LibDDRV

Github Actions

Library for generating discrete random variates from a set of dynamically weighted elements in Solidity.

Based on this paper.

The algorithm preprocesses a list of weighted elements into a forest of trees data structure, and then traverses that forest to generate a random variate from the discrete distribution in sublinear time. Critically, the library supports inserting, updating, and deleting elements from the forest.

more to come

Getting Started

Contributing

Security