类 Randoms
java.lang.Object
com.weicoder.common.statics.Randoms
- 直接已知子类:
S.R
随机数使用类
- 作者:
- wdcode
-
构造器概要
构造器 -
方法概要
修饰符和类型方法说明static Randomcurrent()返回当前线程的ThreadLocalRandomstatic byte[]nextBytes(int len, int m, int n) 随机获得一个字节数组 确保输入的m和n在byte之内 不做额外验证static byte[]随机获得一个字节数组 确保输入的m和n在byte之内 不做额外验证static byte[]随机获得一个字节数组 确保输入的m和n在byte之内 不做额外验证static List<byte[]> 随机获得一个字节数组列表 验证s与e在Byte.min~Byte.max之间static double同方法Random.nextDouble()static float同方法Random.nextFloat()static intnextInt()同方法Random.nextInt()static intnextInt(int n) 同方法Random.nextInt(n)static intnextInt(int m, int n) 在m-n的范围中随机获得static longnextLong()同方法Random.nextLong()static Randomrandom()声明个新的Randomstatic Stringrandom(int len) 获取指定位数的随机数static Randomsecure()声明个新的SecureRandom
-
构造器详细资料
-
Randoms
public Randoms()
-
-
方法详细资料
-
current
返回当前线程的ThreadLocalRandom- 返回:
- ThreadLocalRandom 独立线程的随机数
-
random
声明个新的Random- 返回:
- Random
-
secure
声明个新的SecureRandom- 返回:
- SecureRandom
-
nextBytes
public static byte[] nextBytes(int len, int m, int n) 随机获得一个字节数组 确保输入的m和n在byte之内 不做额外验证- 参数:
len- 生成长度m- 开始数n- 结束数- 返回:
- 字节数组
-
nextBytes
随机获得一个字节数组 确保输入的m和n在byte之内 不做额外验证- 参数:
r- 随机数生成类len- 生成长度m- 开始数n- 结束数- 返回:
- 字节数组
-
nextBytes
随机获得一个字节数组 确保输入的m和n在byte之内 不做额外验证- 参数:
r- 随机数生成类len- 生成长度is- 是否可重复 true 可重复 false 不可重复m- 开始数n- 结束数- 返回:
- 字节数组
-
nextBytes
随机获得一个字节数组列表 验证s与e在Byte.min~Byte.max之间- 参数:
r- 随机数生成类len- 生成长度s- 开始数e- 结束数n- 生成列表长度is- 是否可重复 true 可重复 false 不可重复- 返回:
- 字节数组
-
nextInt
public static int nextInt()同方法Random.nextInt()- 返回:
- int 返回的随机数
-
nextInt
public static int nextInt(int n) 同方法Random.nextInt(n)- 参数:
n- 在0-n的范围中- 返回:
- int 返回的随机数
-
nextInt
public static int nextInt(int m, int n) 在m-n的范围中随机获得- 参数:
m- 起始数n- 结束数- 返回:
- int 返回的随机数
-
nextDouble
public static double nextDouble()同方法Random.nextDouble()- 返回:
- double 返回的随机数
-
nextFloat
public static float nextFloat()同方法Random.nextFloat()- 返回:
- float 返回的随机数
-
nextLong
public static long nextLong()同方法Random.nextLong()- 返回:
- long 返回的随机数
-
random
获取指定位数的随机数- 参数:
len- 随机长度- 返回:
- 字符串格式的随机数
-