LongPrimitiveIterator stream,
int streamSize,
RandomGenerator random) {
LongPrimitiveIterator it;
if (n < streamSize) {
it = new SamplingLongPrimitiveIterator(random, stream, (double) n / streamSize);
} else {
it = stream;
}
FastIDSet chosen = new FastIDSet(n);
while (it.hasNext()) {