生成count位随机数工具类

工具类

import java.util.Random;

/**
 * 生成6位随机数字
 */
public class GeneratorCode {

	/**
	 * 
	  * @Title: getCode
	  * @Description: 生成count个随机数
	  * @param @param count
	  * @param @return    参数
	  * @return String    返回类型
	  * @throws
	 */
    public static String getCode(int count) {
        StringBuffer s = new StringBuffer();
        for (int i = 0; i < count; i++) {
            s.append(String.valueOf(new Random().nextInt(10)));
        }
        return s.toString();
    }
}

猜你喜欢

转载自www.cnblogs.com/lichangyunnianxue/p/9933703.html
今日推荐