RV_ABSOLUTE_VALUE_OF_RANDOM_INT 使用错误 - 尝试计算32位随机整数的绝对值
Math.abs(System.currentTimeMillis())
说明: Math.abs 不一定返回的数据是正数,下面是个例子:
System.out.println(Math.abs(Long.MIN_VALUE));
这个执行的结果是: -9223372036854775808
解释: Consider a byte. Its value ranges from -128 to 127. Say your byte has a value of -100, then Math.abs(-100) will give you 100. But what if the value of your byte is -128? You cannot represent 128 as a byte, since the maximum value it can represent is 127. So Math.abs() simply returns the negative parameter, unchanged.
解决办法:
Use rand.nextInt(Integer.MAX_VALUE);instead of Math.abs(rand.nextInt())
参考地址: