/** * @Author : lilong * @Description :根据生成随机数算法等到随机数---长度为10位的随机字符串 * @Date : 10:12 2018/5/4 **/ public static final String allChar = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; public static String getNonce() { StringBuffer sb = new StringBuffer(); Random random = new Random(); for (int i = 0; i < 10; i++) { sb.append(allChar.charAt(random.nextInt(allChar.length()))); } System.err.println(sb.toString()); return sb.toString(); }
生成随机字符串
猜你喜欢
转载自blog.csdn.net/qq_19167629/article/details/80192468
今日推荐
周排行