类 RandomKit

java.lang.Object
com.iohao.game.common.kit.RandomKit

public class RandomKit extends Object
作者:
渔民小镇
日期:
2022-07-14
  • 构造器概要

    构造器
    构造器
    说明
     
  • 方法概要

    修饰符和类型
    方法
    说明
    int
    random(int end)
    获得指定范围内的随机数 (0 ~ end)
    int
    random(int start, int end)
    获得指定范围内的随机数
    long
    random(long end)
    获得指定范围内的随机数 (0 ~ end)
    long
    random(long start, long end)
    获得指定范围内的随机数
    boolean
    随机一个 bool 值
    <T> T
    randomEle(List<T> list)
     
    <T> T
    randomEle(T[] array)
     
    int
    randomInt(int limit)
    获得指定范围内的随机数 [0,limit)
    int
    randomInt(int min, int max)
    获得指定范围内的随机数
    long
    randomLong(long limit)
    获得指定范围内的随机数 [0,limit)
    long
    randomLong(long min, long max)
    获得指定范围内的随机数

    从类继承的方法 java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 构造器详细资料

    • RandomKit

      public RandomKit()
  • 方法详细资料

    • randomInt

      public int randomInt(int limit)
      获得指定范围内的随机数 [0,limit)
      参数:
      limit - 限制随机数的范围,不包括这个数
      返回:
      随机数
    • randomInt

      public int randomInt(int min, int max)
      获得指定范围内的随机数
      参数:
      min - 最小数(包含)
      max - 最大数(不包含)
      返回:
      随机数
    • randomLong

      public long randomLong(long limit)
      获得指定范围内的随机数 [0,limit)
      参数:
      limit - 限制随机数的范围,不包括这个数
      返回:
      随机数
      从以下版本开始:
      21.23
    • randomLong

      public long randomLong(long min, long max)
      获得指定范围内的随机数
      参数:
      min - 最小数(包含)
      max - 最大数(不包含)
      返回:
      随机数
      从以下版本开始:
      21.23
    • random

      public int random(int start, int end)
      获得指定范围内的随机数
      参数:
      start - 开始值(包含)
      end - 结束值(包含)
      返回:
      随机数
    • random

      public int random(int end)
      获得指定范围内的随机数 (0 ~ end)
      参数:
      end - 结束值(包含)
      返回:
      随机数
    • random

      public long random(long start, long end)
      获得指定范围内的随机数
      参数:
      start - 开始值(包含)
      end - 结束值(包含)
      返回:
      随机数
      从以下版本开始:
      21.23
    • random

      public long random(long end)
      获得指定范围内的随机数 (0 ~ end)
      参数:
      end - 结束值(包含)
      返回:
      随机数
      从以下版本开始:
      21.23
    • randomBoolean

      public boolean randomBoolean()
      随机一个 bool 值
      返回:
      bool 值
    • randomEle

      public <T> T randomEle(List<T> list)
    • randomEle

      public <T> T randomEle(T[] array)