Here you can find the source of random(int length)
public static String random(int length)
//package com.java2s; //License from project: LGPL public class Main { public static String random(int length) { if (length > 16) length = 16;/*from ww w. j av a2s .co m*/ String str = Math.random() + ""; return str.substring(str.length() - length); } }