Here you can find the source of genRandomString(int pLength)
private static String genRandomString(int pLength)
//package com.java2s; //License from project: Open Source License import java.util.Random; public class Main { private static String genRandomString(int pLength) { 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()))); }// ww w. j a va2 s .co m return sb.toString(); } }