Java tutorial
//package com.java2s; import java.util.Random; public class Main { public static String randomString(int stringLength) { char[] chars = "abcdefghijklmnopqrstuvwxyz".toCharArray(); StringBuilder randomStringBuilder = new StringBuilder(); Random random = new Random(); for (int i = 0; i < stringLength; i++) { char c = chars[random.nextInt(chars.length)]; randomStringBuilder.append(c); } return randomStringBuilder.toString(); } }