mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-05-09 23:51:34 +08:00
add method
This commit is contained in:
parent
d204d58057
commit
b5036b4b0b
@ -8,6 +8,7 @@
|
||||
### 🐣新特性
|
||||
* 【db 】 Db.quietSetAutoCommit增加判空(issue#I4D75B@Gitee)
|
||||
* 【core 】 增加RingIndexUtil(pr#438@Gitee)
|
||||
* 【core 】 Assert增加checkBetween重载(pr#436@Gitee)
|
||||
*
|
||||
### 🐞Bug修复
|
||||
* 【core 】 修复CollUtil.isEqualList两个null返回错误问题(issue#1885@Github)
|
||||
|
@ -844,8 +844,8 @@ public class Assert {
|
||||
* @param min 最小值(包含)
|
||||
* @param max 最大值(包含)
|
||||
* @param errorSupplier 错误抛出异常附带的消息生产接口
|
||||
* @throws X if value is out of bound
|
||||
* @return 经过检查后的值
|
||||
* @throws X if value is out of bound
|
||||
* @since 5.7.15
|
||||
*/
|
||||
public static <X extends Throwable> int checkBetween(int value, int min, int max, Supplier<? extends X> errorSupplier) throws X {
|
||||
@ -889,8 +889,8 @@ public class Assert {
|
||||
* @param min 最小值(包含)
|
||||
* @param max 最大值(包含)
|
||||
* @param errorSupplier 错误抛出异常附带的消息生产接口
|
||||
* @throws X if value is out of bound
|
||||
* @return 经过检查后的值
|
||||
* @throws X if value is out of bound
|
||||
* @since 5.7.15
|
||||
*/
|
||||
public static <X extends Throwable> long checkBetween(long value, long min, long max, Supplier<? extends X> errorSupplier) throws X {
|
||||
@ -934,8 +934,8 @@ public class Assert {
|
||||
* @param min 最小值(包含)
|
||||
* @param max 最大值(包含)
|
||||
* @param errorSupplier 错误抛出异常附带的消息生产接口
|
||||
* @throws X if value is out of bound
|
||||
* @return 经过检查后的值
|
||||
* @throws X if value is out of bound
|
||||
* @since 5.7.15
|
||||
*/
|
||||
public static <X extends Throwable> double checkBetween(double value, double min, double max, Supplier<? extends X> errorSupplier) throws X {
|
||||
|
@ -163,6 +163,16 @@ public class RandomUtil {
|
||||
return 0 == randomInt(2);
|
||||
}
|
||||
|
||||
/**
|
||||
* 随机汉字('\u4E00'-'\u9FFF')
|
||||
*
|
||||
* @return 随机的汉字字符
|
||||
* @since 5.7.15
|
||||
*/
|
||||
public static char randomChinese() {
|
||||
return (char) randomInt('\u4E00', '\u9FFF');
|
||||
}
|
||||
|
||||
/**
|
||||
* 获得指定范围内的随机数
|
||||
*
|
||||
|
@ -53,4 +53,10 @@ public class RandomUtilTest {
|
||||
final byte[] c = RandomUtil.randomBytes(10);
|
||||
Assert.assertNotNull(c);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void randomChineseTest(){
|
||||
char c = RandomUtil.randomChinese();
|
||||
Assert.assertTrue(c > 0);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user