3.采用多种算法,模拟摇奖:从1-36中随机抽出8个不重复的数字
int[] shuzu=new int[8];
		Random ran=new Random();
		for(int i=0;i<shuzu.length;i++)
		{
			shuzu[i]=ran.nextInt(36);
			for(int j=0;j<i;j++)
			{
				if(shuzu[i]==shuzu[j])
				{
					i--;
				}
			}
			
		}
		for(int i=0;i<shuzu.length;i++)
		{System.out.println(shuzu[i]);}

  

相关文章:

  • 2021-09-27
  • 2022-12-23
  • 2022-12-23
  • 2021-11-30
  • 2021-05-04
  • 2022-12-23
  • 2022-02-09
  • 2022-12-23
猜你喜欢
  • 2021-04-16
  • 2021-06-21
  • 2021-04-18
  • 2021-12-24
  • 2021-06-24
  • 2022-12-23
  • 2021-11-30
相关资源
相似解决方案