日期时分秒毫秒+3位随机数
作者:互联网
public String getString() { String pkValue; String str = new SimpleDateFormat("yyyyMMddHHmmssSSS").format(new Date()); int rannum = (int) (new Random().nextDouble() * (999 - 100 + 1)) + 100;// 获取3位随机数 // pkValue= UUID.randomUUID().toString().replace("-",""); pkValue= str+rannum; return pkValue; }
标签:rannum,String,int,pkValue,毫秒,随机数,new,100,时分秒 来源: https://www.cnblogs.com/woftlcj/p/11410804.html