package org.linlinjava.jz.db.util;

import java.util.Random;

/**
 * 产生一个指定长度的随机码
 */
public class RandUtil {
    public static String getRandomNum(Integer num) {
        String base = "0123456789";
        Random random = new Random();
        StringBuffer sb = new StringBuffer();
        for (int i = 0; i < num; i++) {
            int number = random.nextInt(base.length());
            sb.append(base.charAt(number));
        }
        return sb.toString();
    }
}
