日期时分秒毫秒+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;
    }

  

posted @ 2019-08-26 09:58  CJ.Lee  阅读(1153)  评论(0编辑  收藏  举报