Java tutorial
//package com.java2s; import java.util.Random; public class Main { static Random random = new Random(System.currentTimeMillis()); static String LETTER_NUMBER_LOWER = "abcdefghijklmnopqrstuvwxyz0123456789"; public static String nextString(int length) { StringBuilder vals = new StringBuilder(); for (int i = 0; i < length; i++) { vals.append(LETTER_NUMBER_LOWER.charAt(random.nextInt(length))); } return vals.toString(); } }