package cn.superdesk.uniorder.common.sequence;

import java.util.Random;

public class GenRandomHelper {

	/**
	 * 生成指定长度的随机数字
	 *
	 * @param pwd_len
	 * @return
	 */
	public static String genRandomNum(final int pwd_len) {

		final char[]  str = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9'};
		StringBuilder pwd = new StringBuilder(pwd_len);

		// 生成的密码的长度
		int    count = 0;
		Random rand  = new Random();
		while (count < pwd_len) {
			int i = rand.nextInt(str.length);
			pwd.append(str[i]);
			count++;
		}

		return pwd.toString();
	}

}
