一 生成100以内的随机4个整数,且放入数组
Random rand = new Random(System.currentTimeMillis());
int[] ret = new int[4];
for (int i = 0; i < ret.length; i++) {
ret[i] = rand.nextInt(100);
System.out.println(ret[i]);
}

其他操作待续。
最后
以上就是整齐小猫咪最近收集整理的关于各种生成随机数的实例的全部内容,更多相关各种生成随机数内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复