Long minVal = 9223372036854774807L;
Long maxVal = 0L;
if(maxVal < minVal){
throw new Exception("最小值不能比最大值大");
}
long v = minVal + (long) (new Random().nextDouble() * (maxVal - minVal));
生成Long类型的随机数
最新推荐文章于 2024-11-11 16:57:31 发布
Long minVal = 9223372036854774807L;
Long maxVal = 0L;
if(maxVal < minVal){
throw new Exception("最小值不能比最大值大");
}
long v = minVal + (long) (new Random().nextDouble() * (maxVal - minVal));