Random类
import java.util.Random;
public class RandomDemo1 {
public static void main(String[] args) {
// Math.random() [0.0, 1.0)
Random random = new Random();
// System.out.println(random.nextInt());
//1-100
int i = random.nextInt(100) + 1; // [1,101)
System.out.println(i);
}
}

浙公网安备 33010602011771号