IdGen工具新增,随机生成指定范围的Integer值

This commit is contained in:
thinkgem
2019-06-26 17:12:26 +08:00
parent bf7daeed16
commit 956b82ba65

View File

@@ -42,6 +42,13 @@ public class IdGenerate {
random.nextBytes(randomBytes);
return EncodeUtils.encodeBase62(randomBytes);
}
/**
* 使用SecureRandom随机生成指定范围的Integer.
*/
public static int randomInt(int min, int max) {
return random.nextInt(max) % (max - min + 1) + min;
}
/**
* 获取新唯一编号18为数值