public static <T> List<T> getRandomList(List<T> baseList, int num) {
        if (baseList == null) {
            return new ArrayList<>();
        }
        // make sure num cannot exceed size of base list
        List<T> newHostList = new ArrayList<>(baseList);
        Collections.shuffle(newHostList);
        num = Math.min(num, baseList.size());
        return newHostList.subList(0, num);
    }
get random list of base list.

@param baseList base list
@param num max Num
@return random list
inlong-agent/agent-plugins/src/main/java/org/apache/inlong/agent/plugin/fetcher/ManagerResultFormatter.java