指定区间随机数公式: (Math.random()*(最大数-最小数+1)+最小数)
public class Test {
public static void main(String[] args) {
for (int i = 0; i < 50; i++) {
//随机两个数区间(Math.random()*(最大数-最小数+1)+最小数)
int x = (int) (Math.random()*(9999-1000+1)+1000);
System.out.println(x);
}
}
}