Java 通过Math.random() 生成6位随机数
1 public static void main(String[] args) { 2 String sjs=""; 3 4 for (int i = 0; i < 6; i++) { 5 int max=9,min=0; 6 int ran2 = (int) (Math.random()*(max-min)+min); 7 System.out.println(ran2 ); 8 sjs=ran2+sjs; 9 } 10 System.out.println("6位随机数: "+sjs ); 11 }
不拼搏 枉少年