import java.util.Random;
public class Rand {
public static void main(String args[]) {
Random ran = new Random();
int number = ran.nextInt(9) + 1;
number *= 10000;
number += ran.nextInt(10000);
System.out.println("Random no:" + number);
}
}
答案 0 :(得分:0)
它有什么神秘之处?
public static void main(String args[])
{
Random ran = new Random();
//Generate a digit between 0-8 +1
int number = ran.nextInt(9) + 1;
//Multiply with 10000
number *= 10000;
//Add a number between 0-9999
number += ran.nextInt(10000);
System.out.println("Random no:" + number);
}
在你提出要求之前,你应该获得一些基础知识 - 或者至少试着自己解决问题。