修复Linux环境下随机数方法造成的系统死锁问题

This commit is contained in:
lixuetao
2023-11-10 11:32:00 +08:00
parent f290bf532f
commit 7509312cce
4 changed files with 10 additions and 30 deletions
@@ -360,7 +360,7 @@ public class oConvertUtils {
/**
* SET转换MAP
*
* @param str
* @param setobj
* @return
*/
public static Map<Object, Object> SetToMap(Set<Object> setobj) {
@@ -450,7 +450,7 @@ public class oConvertUtils {
* 如果转换前的下划线大写方式命名的字符串为空,则返回空字符串。</br>
* 例如:hello_world,test_id->helloWorld,testId
*
* @param name
* @param names
* 转换前的下划线大写方式命名的字符串
* @return 转换后的驼峰式命名的字符串
*/
@@ -524,28 +524,6 @@ public class oConvertUtils {
return sb.toString().toLowerCase();
}
/**
* 随机数
* @param place 定义随机数的位数
*/
public static String randomGen(int place) {
String base = "qwertyuioplkjhgfdsazxcvbnmQAZWSXEDCRFVTGBYHNUJMIKLOP0123456789";
StringBuilder sb = new StringBuilder();
Random rd = null;
try {
rd = SecureRandom.getInstanceStrong();
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
}
if(Objects.isNull(rd)){
return null;
}
for(int i=0;i<place;i++) {
sb.append(base.charAt(rd.nextInt(base.length())));
}
return sb.toString();
}
/**
* 获取类的所有属性,包括父类
*