Random:产生随机数的类
构造方法:
public Random():没有给种子,用的是默认种子,是当前时间的毫秒值 public Random(long seed):给出种子给定种子后,每次得到的随机数是相同的
成员方法:
public int nextInt():返回的是int范围内的随机数 public int nextInt(int n):返回的是[0,n)范围内随机数本文共 245 字,大约阅读时间需要 1 分钟。
Random:产生随机数的类
构造方法:
public Random():没有给种子,用的是默认种子,是当前时间的毫秒值 public Random(long seed):给出种子给定种子后,每次得到的随机数是相同的
成员方法:
public int nextInt():返回的是int范围内的随机数 public int nextInt(int n):返回的是[0,n)范围内随机数转载于:https://www.cnblogs.com/Deleting/p/5068650.html