public static long buildRandom(int length) {
        long num = 1;
        double random = Math.random();
        if (random < 0.1) {
            random = random + 0.1;
        }
        for (int i = 0; i < length; i++) {
            num = num * 10;
        }
        return (long) ((random * num));
    }

 参考资料:https://www.cnblogs.com/jdbn/p/10089719.html

posted on 2020-07-22 14:25  张誉峰  阅读(491)  评论(0)    收藏  举报