# weighted_random v1.0.0-alpha.0 - Table of Contents

> Fast, flexible, powerful framework for simulating weighted randomness

## GUIDES

- [WeightedRandom](readme.md)
- [Changelog](changelog.md)

## Modules

- [WeightedRandom](WeightedRandom.md): 
## Usage
- [WeightedRandom.Backend](WeightedRandom.Backend.md): WeightedRandom.Backend offers a contract to all who implement it:
1. The main WeightedRandom package presents a novel interface for generating a list of probabilities (floats that can be summed to equal exactly 1.0).
2. The custom Backend module decides what to do with those probabilities once they are generated.
- [WeightedRandom.Backend.Linear](WeightedRandom.Backend.Linear.md): 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.
- [WeightedRandom.Backend.WalkerAlias](WeightedRandom.Backend.WalkerAlias.md): This is just a wrapper around the [WAM](https://hex.pm/packages/wam) hex package, which implements the Walker Alias Method.

- [WeightedRandom.CubicBezier](WeightedRandom.CubicBezier.md): Copied from https://github.com/bjunc/cubic-bezier/tree/master
Unfortunately the build seems to be broken so I could not use it directly.

- [WeightedRandom.Dice](WeightedRandom.Dice.md)
- [WeightedRandom.Die](WeightedRandom.Die.md): Represents a single Die, with a certain number of sides, weights, and current result.

