# weighted_random v1.0.0-rc.1 - Table of Contents

> Fast and flexible framework for simulating weighted randomness with custom probabilities and bias.

## Pages

- [Changelog](changelog.md)
- [README](readme.md)
- [Upgrading Guide](upgrading_guide.md)

- Static Tutorial
  - [1. Quickstart](1_quickstart-1.md)
  - [2. Dice](2_dice-2.md)
  - [3. Multi-Target Weights](3_multi_target_weights-3.md)

- Livebook Tutorial
  - [1. Quickstart](1_quickstart-4.md)
  - [2. Dice](2_dice-5.md)
  - [3. MultiTarget Weights](3_multi_target_weights-6.md)

## Modules

- [WeightedRandom](WeightedRandom.md): ## Tutorials
- [WeightedRandom.Utils.Crypto](WeightedRandom.Utils.Crypto.md): Based on this [blog post](https://hashrocket.com/blog/posts/the-adventures-of-generating-random-numbers-in-erlang-and-elixir)
run `reseed`, to generate a cryptographically secure seed for your random number generators.
- [WeightedRandom.Utils.Types](WeightedRandom.Utils.Types.md)

- Backend
  - [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 my implementation of the Walker Alias Method.
  - [WeightedRandom.Backend.WalkerAlias.Preprocess](WeightedRandom.Backend.WalkerAlias.Preprocess.md)
  - [WeightedRandom.Backend.WalkerAlias.Table](WeightedRandom.Backend.WalkerAlias.Table.md)
  - [WeightedRandom.Backend.WalkerAlias.Take](WeightedRandom.Backend.WalkerAlias.Take.md)
  - [WeightedRandom.Backend.WalkerAlias.Types](WeightedRandom.Backend.WalkerAlias.Types.md)

- Dice
  - [WeightedRandom.Dice](WeightedRandom.Dice.md): ## Creating Dice
  - [WeightedRandom.Dice.Types](WeightedRandom.Dice.Types.md)
  - [WeightedRandom.Die](WeightedRandom.Die.md): A struct and related functions to represent a single die, with any number of sides and weights.

- Exceptions
  - [WeightedRandom.Exceptions.EmptyOutcomes](WeightedRandom.Exceptions.EmptyOutcomes.md)
  - [WeightedRandom.Exceptions.EmptyProbabilities](WeightedRandom.Exceptions.EmptyProbabilities.md)
  - [WeightedRandom.Exceptions.NonFloatProbabilities](WeightedRandom.Exceptions.NonFloatProbabilities.md)
  - [WeightedRandom.Exceptions.NonPositiveProbability](WeightedRandom.Exceptions.NonPositiveProbability.md)

