class BestWaitIdleRule implements IRule {

	@Override
	public DiscordInstance choose(List<DiscordInstance> instances) {<FILL_FUNCTION_BODY>}

}

		if (instances.isEmpty()) {
			return null;
		}
		Map<Integer, List<DiscordInstance>> map = instances.stream()
				.collect(Collectors.groupingBy(i -> {
					int wait = i.getRunningFutures().size() - i.account().getCoreSize();
					return wait >= 0 ? wait : -1;
				}));
		List<DiscordInstance> instanceList = map.entrySet().stream().min(Comparator.comparingInt(Map.Entry::getKey)).orElseThrow().getValue();
		return RandomUtil.randomEle(instanceList);
	
<no_super_class>