chooseAction method
Choose an action for state using epsilon-greedy.
Ties are broken by first occurrence (stable determinism under a seed).
Implementation
int chooseAction(int state) {
if (state < 0 || state >= nStates) {
throw RangeError.index(state, List.filled(nStates, 0), 'state');
}
if (_rand.nextDouble() < epsilon) return _rand.nextInt(nActions);
return bestAction(state);
}