API Reference weighted_random v#1.0.0-rc.2

Copy Markdown View Source

Modules

WeightedRandom.Backend offers a contract to all who implement it

This is a very naive approach. Quick and dirty to implement, but definitely not as fast as most other backends, especially at scale. One advantage it has is a very fast and simple preprocessing phase. So if you only need to run it once, this can actually beat the Walker Alias Method.

A more 'idiomatically elixir' implementation of The Walker Alias Method. Uses the WeightedRandom.Backend behaviour

A struct and related functions to represent a single die, with any number of sides and weights.

Based on this blog post run reseed, to generate a cryptographically secure seed for your random number generators.