int count = agents.count();
if (n > count) {
throw new EngineException(context, this,
I18N.errorsJ().getN("org.nlogo.prim.etc.$common.notThatManyAgentsExist", n, count));
}
return agents.randomSubset(n, count, context.job.random);
} else {
throw new ArgumentTypeException
(context, this, 1, Syntax.ListType() | Syntax.AgentsetType(), obj);
}
}