package com.jpsoft.shinestar.modules.common.utils.Generator;

import cn.hutool.core.util.RandomUtil;
import cn.hutool.core.util.StrUtil;

/**
 * @author 墨鱼_mo
 * @date 2019-8-8 15:25
 */


    public class RandomGeneratorA extends AbstractGeneratorA {
        private static final long serialVersionUID = -7802758587765561876L;

        public RandomGeneratorA(int count) {
            super(count);
        }

        public RandomGeneratorA(String baseStr, int length) {
            super(baseStr, length);
        }

        public String generate() {
            return RandomUtil.randomString(this.baseStr, this.length);
        }

        public boolean verify(String code, String userInputCode) {
            return StrUtil.isNotBlank(userInputCode) ? StrUtil.equalsIgnoreCase(code, userInputCode) : false;
        }
    }

