java list随机截取(洗牌)

public void solution(){
    List<Integer> givenList = Arrays.asList(1, 2, 3,4,5,6);
    Collections.shuffle(givenList);
 
    int randomSeriesLength = 3;
 
    List<Integer> randomSeries = givenList.subList(0, randomSeriesLength);
}
posted @ 2019-12-13 20:11  AllIhave  阅读(478)  评论(0编辑  收藏  举报