/*
 * Decompiled with CFR 0.152.
 */
package com.hst.common.util;

import java.util.Random;

public class HstRandomUtil {
    private static int length = 32;
    public static final String numberChar = "0123456789";
    private static String[] strArray = new String[]{"a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9"};

    public static String generateRandomString(String userId) {
        StringBuffer sessionid = new StringBuffer(userId);
        Random ran = new Random();
        while (sessionid.length() < length) {
            sessionid.append(strArray[ran.nextInt(strArray.length - 1)]);
        }
        return sessionid.toString();
    }

    public static String generateRandomString() {
        return HstRandomUtil.generateRandomString("");
    }

    public static String generateRandomString(String userId, int length) {
        StringBuffer sessionid = new StringBuffer(userId);
        Random ran = new Random();
        while (sessionid.length() < length) {
            sessionid.append(strArray[ran.nextInt(strArray.length - 1)]);
        }
        return sessionid.toString();
    }

    public static String generateRandomString(int length) {
        return HstRandomUtil.generateRandomString("", length);
    }

    public static String generateDigitalString() {
        return HstRandomUtil.generateDigitalString(length);
    }

    public static String generateDigitalString(int length) {
        StringBuffer sb = new StringBuffer();
        Random random = new Random();
        int i = 0;
        while (i < length) {
            sb.append(numberChar.charAt(random.nextInt(numberChar.length())));
            ++i;
        }
        return sb.toString();
    }

    public static void main(String[] arg) {
        System.out.println("------" + HstRandomUtil.generateRandomString("sdfasfdasdfd"));
        System.out.println("------" + HstRandomUtil.generateRandomString("sdfasfdasdfd").length());
        System.out.println(HstRandomUtil.generateRandomString(30));
        System.out.println(HstRandomUtil.generateDigitalString(30));
        System.out.println(HstRandomUtil.generateDigitalString().length());
    }
}
