public static String disorderString(String str) {
        List<String> list = Arrays.asList(str.split(""));
        Collections.shuffle(list);
        String out = new String();
        for (String s : list) {
            out += s;
        }
        return out;
    }


    //字符串中检出n个字符
    public static String pickRandomString(String str, int length) {

        String strChaos = disorderString(str);
        return strChaos.substring(0, length);
    }

发表评论

您的电子邮箱地址不会被公开。 必填项已用*标注

Captcha Code