Official Site

click here to view our new site launched

Pages

Tuesday, February 8, 2011

Random number generation in Java

import java.util.*;
import java.text.SimpleDateFormat;
import java.util.Date;

public class RandomGen {

public String genRandom() throws Exception {

String random = "";

Date date = new Date();

SimpleDateFormat sdf = new SimpleDateFormat("yyMMddHHmmssSS");

random+=sdf.format(date);

return random;
}

}

No comments:

Post a Comment

$2.49 .COM at GoDaddy.com! Expires 5/14/13