Here you can find the source of getRandom(int c)
public static String getRandom(int c)
//package com.java2s; //License from project: Open Source License import java.text.SimpleDateFormat; import java.util.Date; import java.util.Random; public class Main { public static String getRandom(int c) { Random r = new Random(); SimpleDateFormat format = new SimpleDateFormat("ssSSS"); Date d = new Date(); StringBuffer sb = new StringBuffer(); // for(int i = 0; i < c; i ++){ sb.append(format.format(d));/*from w w w . j a v a2 s. com*/ sb.append(r.nextInt(10)); // } //// System.out.println(sb.toString()); // return sb.toString().substring(1,7); return sb.toString(); } }