List of utility methods to do Random String Create
String | getRandomString(int len) get Random String String returnStr = ""; char[] ch = new char[len]; Random rd = new Random(); for (int i = 0; i < len; i++) { ch[i] = (char) (rd.nextInt(9) + 97); returnStr = new String(ch); return returnStr; ... |
String | getRandomStr(int length) get Random Str if (length < 1) { return null; Random random = new Random(); char[] buf = new char[length]; int index = 0; for (int i = 0; i < length; i++) { index = random.nextInt(SOURCE.length); ... |
String | getRandomString(int length) get Random String Random random = new Random(System.currentTimeMillis()); byte[] randomBytes = new byte[length]; for (int i = 0; i < length; i++) { randomBytes[i] = CHARS[random.nextInt(CHARS.length)]; return new String(randomBytes); |
String | randomString(int size) random String StringBuilder sb = new StringBuilder(); for (int i = 0; i < size; i++) { sb.append((char) (((int) 'A') + Math.random() * 25)); return sb.toString(); |
String | randomIVString() random IV String return new BigInteger(130, random).toString(16); |
String | getRandomString() get Random String final SecureRandom random = new SecureRandom(); return String.valueOf(random.nextLong()); |
String | getRandomPwd() get Random Pwd StringBuilder sb = new StringBuilder(); for (int i = 0; i < 6; i++) { sb.append(getRandomIntNum(9)); return sb.toString(); |
String | genRandomString(int pLength) gen Random String Random r = new Random(); String letter = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; StringBuffer sb = new StringBuffer(); for (int i = 0; i < pLength; i++) { sb.append(letter.charAt(r.nextInt(1000000) % (letter.length()))); return sb.toString(); |
String | generateRandom() generate Random Random number = new Random(); StringBuilder message = new StringBuilder(); for (int i = 0; i < 1405; i++) { message.append('a' + number.nextInt(52)); return message.toString(); |
String | randomAlphaNumeric(int length) random Alpha Numeric StringBuffer buffer = new StringBuffer(); String characters = "abcdefghijklmnopqrstuvwxyz0123456789"; int charactersLength = characters.length(); for (int i = 0; i < length; i++) { double index = Math.random() * charactersLength; buffer.append(characters.charAt((int) index)); return buffer.toString(); ... |