code: def _selection(candidate):
          
          sample_index1 = np.random.choice(len(candidate))
          sample_index2 = np.random.choice(len(candidate))
          sample_1 = candidate[sample_index1]
          sample_2 = candidate[sample_index2]
          select_index = np.random.choice(len(sample_1))
          logger.info(
              LOGGING_PREFIX + "Perform selection from %sth to %sth at index=%s",
              sample_index2, sample_index1, select_index)
  
          next_gen = []
          for i in range(len(sample_1)):
              if i is select_index:
                  next_gen.append(sample_2[i])
              else:
                  next_gen.append(sample_1[i])
          return next_gen
docs: Perform selection action to candidates.
  
          For example, new gene = sample_1 + the 5th bit of sample2.
  
          Args:
              candidate: List of candidate genes (encodings).
  
          Examples:
              >>> # Genes that represent 3 parameters
              >>> gene1 = np.array([[0, 0, 1], [0, 1], [1, 0]])
              >>> gene2 = np.array([[0, 1, 0], [1, 0], [0, 1]])
              >>> new_gene = _selection([gene1, gene2])
              >>> # new_gene could be gene1 overwritten with the
              >>> # 2nd parameter of gene2
              >>> # in which case:
              >>> #   new_gene[0] = gene1[0]
              >>> #   new_gene[1] = gene2[1]
              >>> #   new_gene[2] = gene1[0]
  
          Returns:
              New gene (encoding)