code: def _argsort_and_resolve_ties(time, random_state):
          
          n_samples = len(time)
          order = numpy.argsort(time, kind="mergesort")
  
          i = 0
          while i < n_samples - 1:
              inext = i + 1
              while inext < n_samples and time[order[i]] == time[order[inext]]:
                  inext += 1
  
              if i + 1 != inext:
                  # resolve ties randomly
                  random_state.shuffle(order[i:inext])
              i = inext
          return order
docs: Like numpy.argsort, but resolves ties uniformly at random