Here you can find the source of generateRandom()
public static String generateRandom()
//package com.java2s; //License from project: Open Source License import java.util.Date; import java.util.concurrent.atomic.AtomicLong; public class Main { /**//from ww w.jav a 2 s. c om * Counter used in combination with a timestamp to make random string. */ private static final AtomicLong ATOMIC_COUNT = new AtomicLong(); /** * Generates a random String. Can be useful for creating unique URLs by adding the String as a query parameter to * the URL. * * @return a random string */ public static String generateRandom() { long next = ATOMIC_COUNT.incrementAndGet(); StringBuffer random = new StringBuffer(); random.append(new Date().getTime()).append('-').append(next); return random.toString(); } }