WeightedRandom

Introduction

Sometimes random is too random. The WeightedRandom package is a framework manipulating probability.

This library is:

## Visual example
Here I demonstrate picking 10_000 random numbers, and count how many times each
number came up.
Keep in mind that the target is 45. So numbers to the left of it are negative, as far as the curve is concerned. That's why an `ease-in` looks backward to the left, and normal to the right of 45.
```elixir
range = 1..100
target = 45
weight = 15
radius = 25

Enum.random(1..100)

Image

Ease In

Image

Ease Out

Image

Installation

For older versions of elixir (before 1.17) and old OTP (before 27)

def deps do
[
{:weighted_random, "~> 0.4.2"}
]
end

For newer projects

# mix.exs
def deps do
[
{:weighted_random, "~> 1.0.0-alpha.1"}
]
end