Here you can find the source of randomStr(int length)
public static String randomStr(int length)
//package com.java2s; //License from project: Apache License public class Main { private final static String ALPHABET = "asdfghjklpoiuytrewqzxcvbnm=-0987654321_+ASDFGHJKLPOIUYTREWQZXCVBNM"; public static String randomStr(int length) { return random(length, ALPHABET); }/*from w w w . j a va 2 s .co m*/ private static String random(int length, String data) { String str = ""; int len = data.length(); while (length > 0) { length--; str += data.charAt((int) (Math.random() * len)); } return str; } }