/*
* 实现双色球的彩票功能。
* 规则:从36个红球中随机选择不重复的6个数,
* 从15个篮球中随机选择1个组成一注彩票。
* 可以选择买多注。
* */
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
System.out.println("您要买几注?");
int count = scanner.nextInt();
for (int i = 1; i <= count; i++) {
System.out.print("第" + i + "注是:");
for (int j = 0; j < 6; j++) {//红球
int numRed = (int) (Math.random() * 36 + 1);
System.out.print(numRed + "\t");
}
int numBlue = (int) (Math.random() * 15 + 1);
System.out.println("| " + numBlue);
}
}
输出结果: