Java examples for java.util:Random String
gen Random String
//package com.java2s; import java.util.Random; public class Main { private static final String AB = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ "; private static Random rnd = new Random(); public static String genRandomString(int len) { StringBuilder sb = new StringBuilder(len); for (int i = 0; i < len; i++) sb.append(AB.charAt(rnd.nextInt(AB.length()))); return sb.toString(); }/* w w w . java 2 s .co m*/ }