Random随机数day12
/*
Random: java针对随机数功能专门提供了一个类
成员方法:
public int nextInt() 随机生成一个数
public int nextInt(int n) 随机生成一个[0,100)的数
*/
public class RandomDemo1 {
public static void main(String[] args) {
Random random = new Random();
//public int nextInt(int n)
//between zero (inclusive) and bound (exclusive)
//[0, 100)
int i = random.nextInt(100) + 1;
System.out.println(i);
}
}