利用java中Math类中的random方法实现
公式[a,b]:(int)(Math.random()*(b-a+1)+a
如获取10~99的随机数
public class Test {
public static void main(String[] args) {
int number = (int)(Math.random()*90)+10;
System.out.println(number);
}
}
实现重复操作会是不同的结果