6位
System.out.println((int)((Math.random()*9+1)*10000));
同理,生成4为随机数:
System.out.println((int)((Math.random()*9+1)*1000));
6位
System.out.println((int)((Math.random()*9+1)*10000));
同理,生成4为随机数:
System.out.println((int)((Math.random()*9+1)*1000));
文章来源:智云一二三科技
文章标题:Java 生成 随机数字
文章地址:https://www.zhihuclub.com/197345.shtml