docs: public int splitByDistance(ArrayModifiableDBIDs ind, int begin, int end, DoubleDataStore tpro, Random rand) {
      DBIDArrayIter it = ind.iter();
      // pick random splitting point based on distance
      double rmin = Double.MAX_VALUE * .5, rmax = -Double.MAX_VALUE * .5;
      int minInd = begin, maxInd = end - 1;
      for(it.seek(begin); it.getOffset() < end; it.advance()) {
        double currEle = tpro.doubleValue(it);
        rmin = Math.min(currEle, rmin);
        rmax = Math.max(currEle, rmax);
      }
  
      if(rmin != rmax) { // if not all elements are the same
        double rs = rmin + rand.nextDouble() * (rmax - rmin);
  
        // permute elements such that all points smaller than the splitting
        // element are on the right and the others on the left in the array
        while(minInd < maxInd) {
          double currEle = tpro.doubleValue(it.seek(minInd));
          if(currEle > rs) {
            while(minInd < maxInd && tpro.doubleValue(it.seek(maxInd)) > rs) {
              maxInd--;
            }
            if(minInd == maxInd) {
              break;
            }
            ind.swap(minInd, maxInd);
            maxInd--;
          }
          minInd++;
        }
      }
      else {
        // if all elements are the same split in the middle
        minInd = (begin + end) >>> 1;
      }
      return minInd;
    }