Commit 532b380d authored by Quxl's avatar Quxl

x

parent db81d321
...@@ -42,5 +42,9 @@ public class MathUtil { ...@@ -42,5 +42,9 @@ public class MathUtil {
return (T)k; return (T)k;
} }
public static int random(int min, int max) {
Random random = new Random();
return random.nextInt(max) % (max - min + 1) + min;
}
} }
...@@ -17,6 +17,7 @@ import java.util.Comparator; ...@@ -17,6 +17,7 @@ import java.util.Comparator;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Random;
import java.util.Map.Entry; import java.util.Map.Entry;
import java.util.TreeMap; import java.util.TreeMap;
import java.util.UUID; import java.util.UUID;
...@@ -53,6 +54,18 @@ import net.sourceforge.pinyin4j.format.exception.BadHanyuPinyinOutputFormatCombi ...@@ -53,6 +54,18 @@ import net.sourceforge.pinyin4j.format.exception.BadHanyuPinyinOutputFormatCombi
*/ */
public class StringUtil { public class StringUtil {
private static final String str="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
public static String getRandomString(int length){
Random random = new Random();
StringBuffer sb=new StringBuffer();
for(int i=0;i<length;i++){
int number=random.nextInt(62);
sb.append(str.charAt(number));
}
return sb.toString();
}
public static String join(Map<String, Object> map, String sign, String before, String after, String joinKey) { public static String join(Map<String, Object> map, String sign, String before, String after, String joinKey) {
sign = sign == null ? "" : sign; sign = sign == null ? "" : sign;
before = before == null ? "" : before; before = before == null ? "" : before;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment