Here you can find the source of getRandomString(int length)
public static String getRandomString(int length)
//package com.java2s; import java.util.Random; public class Main { public static String getRandomString(int length) { StringBuffer buffer = new StringBuffer("0123456789abcdefghijklmnopqrstuvwxyz"); StringBuffer sb = new StringBuffer(); Random r = new Random(); int range = buffer.length(); for (int i = 0; i < length; i++) { sb.append(buffer.charAt(r.nextInt(range))); }//from www.j a v a2 s .c om return sb.toString(); } }