Java tutorial
//package com.java2s; public class Main { public static String generateRandomString(int len) { String all = "0123456789abcdefghijklmnopqrstuvwxyz"; StringBuffer s = new StringBuffer(); for (int i = 0; i < len; i++) { s.append(all.charAt(getRandomNum(36))); } return s.toString(); } public static int getRandomNum(int maxNum) { return (int) (Math.random() * maxNum); } }