产生任意区间的随机数:

1 //    产生任意区间的随机数
2     public void testRandom(int start,int end){
3         int i = (int) (Math.random() * (end - start + 1)) + start;
4         System.out.println("i="+i);
5     }
6   

 

相关文章:

  • 2022-12-23
  • 2022-02-06
  • 2022-02-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-07-09
猜你喜欢
  • 2021-08-17
  • 2022-12-23
  • 2022-12-23
  • 2021-07-29
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案