Java tutorial
//package com.java2s; /******************************************************************************* * Created by Carlos Yaconi * Copyright 2012 Fork Ltd. All rights reserved. * License: GPLv3 * Full license at "/LICENSE" ******************************************************************************/ public class Main { public static String randomAlphaNumeric(int length) { StringBuffer buffer = new StringBuffer(); String characters = "abcdefghijklmnopqrstuvwxyz0123456789"; int charactersLength = characters.length(); for (int i = 0; i < length; i++) { double index = Math.random() * charactersLength; buffer.append(characters.charAt((int) index)); } return buffer.toString(); } }