Here you can find the source of getRandomString()
public static String getRandomString()
//package com.java2s; //License from project: Open Source License import java.util.*; public class Main { public static String getRandomString() { String chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; StringBuilder sb = new StringBuilder(); Random r = new Random(); while (sb.length() < 12) { int index = (int) (r.nextFloat() * chars.length()); sb.append(chars.charAt(index)); }// ww w. j a v a 2s . c om return sb.toString().toLowerCase(); } }