/** * * TODO 方法作用:生成N位验证码 * @return * @Author: 刘泽中 * @Date: 2015-8-27 上午11:59:56 */ public String buildRandN(int N) { String rand = ""; for (int i = 0; i < N; i++) { int ran = (int) (Math.random() * 10); String random = String.valueOf(ran); rand += random; } return rand; }