public class Test {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println("请输入起始数:");
int start = sc.nextInt();
System.out.println("请输入结束数:");
int end = sc.nextInt();
for (int a = 0; a < 100; a++) {
int randomNum = Test.getRandom(start, end);
System.out.println(randomNum);
}
}
public static int getRandom(int start, int end) {
int randomNum = (int) (Math.random() * (end - start)) + start;
return randomNum;
}
}
网友评论