Hi all! I’m pleased to announce the first release of urn a library that implements urns, a very nifty pure functional data structure for randomly sampling with or without replacement from weighted discrete distributions in log time. It provides implementations for using int
s and float
s as weights, though it can be extended to any number like thing that can be uniformly sampled from.
The package is available through opam with opam install urn
, and is distributed under the MIT license.