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

> Fast, flexible, powerful framework for simulating weighted randomness, customizing probabilities and bias.

## Pages

- [Changelog](changelog.md)
- [Tutorial](tutorial.md)

## Modules

- [WeightedRandom](WeightedRandom.md): ## Livebook
- [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.Plotting](WeightedRandom.Utils.Plotting.md): This is mostly for use in Livebooks.

- [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 just a wrapper around the [WAM](https://hex.pm/packages/wam) hex package, which implements the Walker Alias Method.

- Dice
  - [WeightedRandom.Dice](WeightedRandom.Dice.md): Implement standard dice notation with `~d{num_dice, sides, optional_modifier}`

