10-50随机数

import java.util.Random;
//求每个数字出现的次数、出现次数最多的数、出现最大次数的值的数字
public class RandomTest2 {
	public static void main(String[] args) {
		int[] count = new int[41];
		Random random = new Random();//产生随机数
		for(int i=0;i<50;i++){
			int number = random.nextInt(41)+10;//产生随机数[10,50]
			System.out.println(number);
			count[number-10]++;//保存次数 
		}
		
		
		//每个数字出现的次数
		for(int j=0;j

 

你可能感兴趣的:(java基础)