# `Imp.Optimizer.Sampling`
[🔗](https://github.com/deepfates/imp/blob/v0.18.1/lib/imp/optimizer/sampling.ex#L1)

Deterministic sampling helpers for optimizers.

Every sampling operation accepts and returns explicit `:rand` state so
optimizer runs remain reproducible without process-global random state.

# `state`

```elixir
@type state() :: :rand.state()
```

# `choose`

```elixir
@spec choose([value], state()) :: {value, state()} when value: var
```

# `dump`

```elixir
@spec dump(state()) :: map()
```

Serializes an explicit optimizer RNG state into JSON-safe data.

# `integer`

```elixir
@spec integer(pos_integer(), state()) :: {non_neg_integer(), state()}
```

# `load!`

```elixir
@spec load!(map()) :: state()
```

Restores an optimizer RNG state serialized by `dump/1`.

# `new`

```elixir
@spec new(integer()) :: state()
```

# `percentile`

```elixir
@spec percentile([number()], number()) :: float()
```

# `poisson`

```elixir
@spec poisson(number(), state()) :: {non_neg_integer(), state()}
```

# `shuffle`

```elixir
@spec shuffle([value], state()) :: {[value], state()} when value: var
```

# `softmax_choose`

```elixir
@spec softmax_choose([{value, number()}], number(), state()) :: {value, state()}
when value: var
```

# `uniform`

```elixir
@spec uniform(state()) :: {float(), state()}
```

---

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