Here you can find the source of GetRandomStr(int length)
public static String GetRandomStr(int length)
//package com.java2s; //License from project: Apache License import java.util.Random; public class Main { private final static String chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; public static String GetRandomStr(int length) { Random rnd = new Random(System.currentTimeMillis()); StringBuffer buf = new StringBuffer(); for (int i = 0; i < length; i++) { int val = rnd.nextInt(chars.length()); buf.append(chars.charAt(val)); }// w ww. j a v a 2 s . c o m return buf.toString(); } }