public class try{
public static void main{
int[] shuzu = {1,2,3,4,5};
Random r = new Rdandom;
for (i = 0; i < shuzu.lenght; i++){
int b = r.nextInt(shuzu.lenght);
System.out.println(shuzu[b])
}
}
}
因为nexInt里面指定的范围并不会包括该值,如nextInt(10)只能获取0-9的正整数
不知道你这个问题是否已经解决, 如果还没有解决的话: