public static void main(String[] args) {
int max = 90;
int min = 30;
int[] numbers = new int[5];
Random random = new Random();
for(int i=0;i<5;i++){
numbers[i] = random.nextInt(max)%(max-min)+min;
}
for(int i =0;i<5;i++){
System.out.print(numbers[i]+"\n");
}
}
【Java】在30-90之间随机产生5个数
最新推荐文章于 2023-03-22 18:27:50 发布