Here you can find the source of generateRandomString(int length)
public static String generateRandomString(int length)
//package com.java2s; //License from project: Open Source License import java.util.Random; public class Main { public static String generateRandomString(int length) { String base = "abcdefghijklmnopqrstuvwxyz0123456789"; Random random = new Random(); StringBuffer sb = new StringBuffer(); for (int i = 0; i < length; i++) { int number = random.nextInt(base.length()); sb.append(base.charAt(number)); }/*from w w w . j a va2 s . c o m*/ return sb.toString(); } }