import java.util.*;
/**
* @author Mxhlin
* @Email [email protected]
* @Date 2022/09/19/21:30
* @Version
* @Description 双色球案例
*/
public class Demo {
public static void main(String[] args) {
Random ra = new Random();
int blue = ra.nextInt(16) + 1;
Set<Integer> red = new HashSet<>();
while (red.size() < 6)
red.add(ra.nextInt(33)+1);
System.out.println(blue);
System.out.println(red);
ArrayList<Integer> list = new ArrayList<>(red);
list.sort(Comparator.comparingInt(a -> a));
list.add(blue);
System.out.println(list);
}
}
标签:blue,双色球,list,System,案例,ra,集合,red,out
From: https://www.cnblogs.com/xhlin/p/16709197.html