docs: public KNNDistanceOrderResult run(Database database, Relation<O> relation) {
      final DistanceQuery<O> distanceQuery = database.getDistanceQuery(relation, getDistanceFunction());
      final KNNQuery<O> knnQuery = database.getKNNQuery(distanceQuery, k + 1);
  
      final int size = (int) ((sample <= 1.) ? Math.ceil(relation.size() * sample) : sample);
      DBIDs sample = DBIDUtil.randomSample(relation.getDBIDs(), size, rnd);
  
      FiniteProgress prog = LOG.isVerbose() ? new FiniteProgress("Sampling kNN distances", size, LOG) : null;
      double[] knnDistances = new double[size];
      int i = 0;
      for(DBIDIter iditer = sample.iter(); iditer.valid(); iditer.advance(), i++) {
        final KNNList neighbors = knnQuery.getKNNForDBID(iditer, k + 1);
        knnDistances[i] = neighbors.getKNNDistance();
        LOG.incrementProcessed(prog);
      }
      LOG.ensureCompleted(prog);
  
      return new KNNDistanceOrderResult(knnDistances, k);
    }