Java tutorial
//package com.java2s; import java.util.Random; public class Main { public static String RandomString(int length) { String AB = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"; Random rnd = new Random(); StringBuilder sb = new StringBuilder(length); for (int i = 0; i < length; i++) { sb.append(AB.charAt(rnd.nextInt(AB.length()))); } return sb.toString(); } }