package cn.itcast.day07.demo03;
import java.util.Random;
public class Demo02Random {
public static void main(String[] args) {
Random r=new Random();
//100.fori
for (int i = 0; i <5; i++) {
int num = r.nextInt (10);//范围实际上是0-9
System.out.println (num);
}
}
}
Random生成指定范围的随机数
最新推荐文章于 2024-04-24 12:21:03 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)