随机生成数字

for (int i = 0; i<10000;i++){
        //随机生成一位整数
        int random = (int) (Math.random()*9);
        String valueOf = String.valueOf(random);
        //生成uuid的hashCode值
        int hashCode = UUID.randomUUID().toString().hashCode();
        //可能为负数
        if(hashCode<0){
            hashCode = -hashCode;
        }
        String value = valueOf + String.format("%017d", hashCode);
        System.out.println(value);
//        6000000979122325
//        2000001204400593
//        900000000813743018
//        1000000002146735922

 

你可能感兴趣的:(java,工具类)