code: public static DBIDs randomSample(DBIDs ids, double rate, Random random) {
      return rate <= 0 ? ids : // Magic for "no sampling"
          randomSample(ids, Math.min(ids.size(), //
              (int) (rate <= 1 ? rate * ids.size() : rate)), random);
    }
docs: Produce a random sample of the given DBIDs.
  <ul>
  <li>values less or equal 0 mean no sampling.
  <li>values larger than 0, but at most 1, are relative rates.
  <li>values larger than 1 are supposed to be integer counts.
  </ul>
  
  @param ids Original ids, no duplicates allowed
  @param rate Sampling rate
  @param random Random generator
  @return Sample