随机固定位数的随机数

//随机固定位数的随机数
public class Demo {


public static void main(String[] args) {
Random r = new Random();
String str;
while(true){
str = r.nextInt(1000000)+"";
if(str.length()==6){
System.out.println(str);
break;
}
}
}
}

猜你喜欢

转载自blog.csdn.net/zxk1995/article/details/80579514