Here you can find the source of genRandom(int length)
public static String genRandom(int length)
//package com.java2s; //License from project: Open Source License import java.util.UUID; public class Main { public static String genRandom(int length) { StringBuffer sb = new StringBuffer(); while (sb.length() < length) { String random = UUID.randomUUID().toString().replace("-", ""); sb.append(random);/* w w w. j a va 2s. c o m*/ } return sb.toString().substring(0, length); } }