Java tutorial
//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()))); } return sb.toString(); } }