随机列表
import cn.hutool.core.util.RandomUtil;
public List<Long> getRandomIds(List<Long> mchIds) {
// 随机之前
List<Long> beforeList = Arrays.asList(1L,2L,3L,4L);
// 随机之后
List<Long> randomList = new ArrayList<>();
while (beforeList.size() > 0) {
int randomNum = RandomUtil.randomInt(beforeList.size());
randomList.add(beforeList.get(randomNum));
beforeList.remove(randomNum);
}
return randomList;
}