# `GEPA.Strategies.CandidateSelector`
[🔗](https://github.com/nshkrdotcom/gepa_ex/blob/v0.3.0/lib/gepa/strategies/candidate_selector.ex#L1)

Behavior for selecting which program candidate to mutate.

Candidate selection strategies balance exploration and exploitation in
the optimization search space.

# `select`

```elixir
@callback select(term(), GEPA.State.t(), :rand.state() | nil) ::
  {GEPA.Types.program_idx(), :rand.state()}
  | {GEPA.Types.program_idx(), term(), :rand.state()}
```

Select a candidate program index for mutation.

## Parameters

- `selector_state`: Struct or module implementing the selection logic
- `state`: Current optimization state
- `rand_state`: Erlang random state (optional, for stochastic selectors)

## Returns

Stateless selectors: `{program_idx, new_rand_state}`
Stateful selectors: `{program_idx, updated_selector, new_rand_state}`

---

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