Java tutorial
//package com.java2s; import java.util.UUID; public class Main { /** * Gets random string. * * @param length the length * @return the random string */ public static String getRandomString(int length) { String randomStr = UUID.randomUUID().toString(); while (randomStr.length() < length) { randomStr = String.format("%s%s", randomStr, UUID.randomUUID().toString()); } return randomStr.substring(0, length); } }