如果要生成一个1万到10万之间的随机数 Random r = new Random(); int random = r.nextInt(100000)%(100000-10000+1) + 10000;