code: def tournament_selection(
      fitness: List[float], n: int, size: int = 2
  ) -> np.array:
      """Selects n-individuals based on a tournament selection.
  
      Args:
          fitness (list): List of individuals fitness.
          n: Number of individuals to be selected.
          size: Tournament size.
  
      Returns:
          (np.array): Indexes of selected individuals.
  
      """
  
      selected = []
      for _ in range(n):
          step = [np.random.choice(fitness) for _ in range(size)]
          selected.append(np.where(min(step) == fitness)[0][0])
  
      return selected
  
file_path: opytimizer/opytimizer/math/general.py
imports: from itertools import islice
  from typing import Any, Iterable, List, Optional
  import numpy
  import opytimizer.math.random
label_desc: Use image node_id 4 for calling a global function with example usage: tournament_selection(fitness, n, size) and returns: selected