Java examples for java.util:Random
get Random Alpha String
//package com.java2s; public class Main { public static String getRandomAlphaString(int length) { StringBuilder b = new StringBuilder(); for (int i = 0; i < length; i++) { // ascii 60 to 90 char str = (char) (65 + (int) (Math.random() * (90 - 65))); b.append(str);//from ww w. ja v a 2s . co m } return b.toString(); } }