Android examples for java.util:Random String
get Random String from char list
import java.security.SecureRandom; public class StringUtils { final static String CHARS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; public static String getRandomString(int cnt) { SecureRandom rnd = new SecureRandom(); StringBuffer buf = new StringBuffer(); for (int i = 0; i < cnt; i++) { int val = rnd.nextInt(CHARS.length()); buf.append(CHARS.charAt(val)); }//from w ww .j a va 2 s . c om return buf.toString(); } }