扫码关注官方订阅号
ringa_lee
我是这么做的,迭代器的迭代数目写可以最大(1000)if (it.hasNext()){
FileInfo[] items = it.next(); 在items的长度范围内取随机值作为下标 Random rand = new Random();//随机种子 String key = items[rand.nextInt(items.length)].key;
}这样达到了随机的效果。
微信扫码关注PHP中文网服务号
QQ扫码加入技术交流群
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
PHP学习
技术支持
返回顶部
我是这么做的,
迭代器的迭代数目写可以最大(1000)
if (it.hasNext()){
}
这样达到了随机的效果。