Here you can find the source of getRandomString(int lenght)
public static String getRandomString(int lenght)
//package com.java2s; //License from project: Open Source License import java.util.Random; public class Main { public static String getRandomString(int lenght) { Random rnd = new Random(System.currentTimeMillis()); String alpha = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; StringBuilder b = new StringBuilder(); for (int i = 0; i < lenght; i++) { b.append(alpha.charAt(rnd.nextInt(alpha.length()))); }/*w w w.j a v a2 s . c o m*/ return b.toString(); } }