ValidateCodeUtil
package com.xz.worker.util; import java.util.Random; /** * @author zagwk * @version 1.0 * @date 2020/7/25 0025 14:37 */ public class ValidateCodeUtil { public String createData() { return createData(6); } public String createData(int length) { StringBuilder sb = new StringBuilder(); Random rand = new Random(); for (int i = 0; i < length; i++) { sb.append(rand.nextInt(10)); } return sb.toString(); } }