public static String getRtNum(int length) { int nSeed = 0; int nSeedSize = 62; String strSrc = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; String strKey = ""; for(int i=0; i<length; i++){ nSeed = (int)(Math.random() * nSeedSize) + 1; strKey += String.valueOf(strSrc.charAt(nSeed-1)); } return strKey; }
|