色婷婷狠狠18禁久久YY,CHINESE性内射高清国产,国产女人18毛片水真多1,国产AV在线观看

Java實(shí)現(xiàn)彩票程序

錢瀠龍2年前18瀏覽0評論

Java實(shí)現(xiàn)彩票程序?

import Java.util.ArrayList;import java.util.Collections;import java.util.List;import java.util.Random;public class Main { public static void main(String[] args) { //紅球 33 選6 List<Integer> redBall = new ArrayList<Integer>(); for(int i=0;i<33;i++){ redBall.add(i+1); } System.out.println("開獎紅球:" + select(redBall, 6)); //籃球16選1 List<Integer> blueBall = new ArrayList<Integer>(); for(int i=0;i<16;i++){ blueBall.add(i+1); } System.out.println("開獎藍(lán)球:" + select(blueBall, 1)); } public static List<Integer> select(List<Integer> list,int count){ List<Integer> selectedList = new ArrayList<Integer>(); Random random = new Random(); for(int i=0;i<count;i++){ int index = random.nextInt(list.size()); Integer number = list.get(index); selectedList.add(number); list.remove(index); } Collections.sort(selectedList); return selectedList; }}

java util包,Java實(shí)現(xiàn)彩票程序