# `TuningFork.Rand`
[🔗](https://github.com/jaman/tuning_fork/blob/v0.1.11/tuning_fork/lib/tuning_fork/rand.ex#L1)

Repeatable randomness from a generator value that every function returns alongside its
result.

    {note, rand} = Rand.pick(Rand.new(42), [:a3, :c4, :e4])

# `t`

```elixir
@type t() :: %TuningFork.Rand{state: integer()}
```

# `chance`

```elixir
@spec chance(t(), float()) :: {boolean(), t()}
```

True with the given probability, from 0.0 to 1.0, and the next generator.

# `float`

```elixir
@spec float(t(), number(), number()) :: {float(), t()}
```

A number from `low` up to but not including `high`, and the next generator.

# `int`

```elixir
@spec int(t(), integer(), integer()) :: {integer(), t()}
```

A whole number from `low` to `high`, both included, and the next generator.

# `modulus`

```elixir
@spec modulus() :: pos_integer()
```

The modulus of the generator: every state is below it.

# `new`

```elixir
@spec new(term()) :: t()
```

A generator seeded from any term. The same seed gives the same sequence anywhere.

# `next`

```elixir
@spec next(t()) :: {float(), t()}
```

A number from 0.0 up to but not including 1.0, and the next generator.

# `one_in`

```elixir
@spec one_in(t(), pos_integer()) :: {boolean(), t()}
```

True one time in `n`, and the next generator.

# `pick`

```elixir
@spec pick(t(), [term()]) :: {term(), t()}
```

One element of `list`, and the next generator. An empty list gives `nil`.

# `shuffle`

```elixir
@spec shuffle(t(), [term()]) :: {[term()], t()}
```

The list in a different order, and the next generator.

# `step`

```elixir
@spec step(pos_integer()) :: non_neg_integer()
```

The generator's bare state moved on one step: a whole number from 0 below `modulus/0`.

# `take`

```elixir
@spec take(t(), [term()], non_neg_integer()) :: {[term()], t()}
```

`count` independent picks from `list`, and the next generator. The result may repeat an
element.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
