java获取随机数
Random rand = new Random();
int i = rand.nextInt(); //int范围类的随机数
i = rand.nextInt(100); //生成0-100以内的随机数
i = (int)(Math.random() * 100); //0-100以内的随机数,用Matn.random()方式
作者:RichardCui
出处:https://www.cnblogs.com/yachao1120/
本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。该文章也同时发布在我的独立博客中-RichardCuiBlog。