Here you can find the source of getRandomStringOfLetters(int length)
public static String getRandomStringOfLetters(int length)
//package com.java2s; //License from project: Open Source License import java.util.Random; public class Main { private static final Random _RANDOM = new Random(); /**// ww w . j ava2 s .co m * Generates a random string of characters. */ public static String getRandomStringOfLetters(int length) { StringBuilder buf = new StringBuilder(); for (int i = 0; i < length; i++) buf.append(nextLetter()); return buf.toString(); } /** * Generates a random letter. */ public static char nextLetter() { return (char) (nextInt(26) + 65); } /** * Generates a random integer between 0 (inclusive) and the requested bound (exclusive). */ public static int nextInt(int bound) { return _RANDOM.nextInt(bound); } }