The general use here is based on your combatant's AI settings, e.g. using nearest target or last target.
An action node in your battle AI will provide the found targets for the action and get the actual target based on the AI settings. So, if your battle AI has all player combatants as found targets and the action targets a single combatant, the user having
Attack Last Target enabled will use the last target if it's part of the list, otherwise falling back to other settings (e.g. nearest target), or use a random one out of the list of found targets.
You can randomize this in your battle AI via selected data (e.g. doing this in a separate battle AI to make it reuseable wherever needed):
1)
Select Combatant node to store all found targets into selected data:
- use all combatants: enabled
- combatant scope: current
- combatant origin: combatant
- user: found targets
2)
Select Selected Data node to store a random combatant from the selected data of
#1 into selected data (either same data key to replace it or a new one, doesn't matter).
3)
Clear Found Targets node to remove all found targets.
4)
Use Combatant node to use the random combatant from selected data (from #2).
As for the battle index number - that's not really available as a metric :)