package com.ho.common.tools.util;

import com.ho.common.tools.constant.CommonConstant;

import java.util.concurrent.ThreadLocalRandom;

/**
 * @Description 随机数获取工具类
 * @Author xwz
 * @Date 2024/11/29
 */
public class RandomUtil {

    /**
     * 获取30-60之间的一个整行随机数
     * @return
     */
    public static int getRandomInt() {
        int min = CommonConstant.THIRTY;
        int max = CommonConstant.SIXTY;
        int randomNumber = ThreadLocalRandom.current().nextInt(max - min + 1) + min;
        return randomNumber;
    }

    public static int getRandomIntHuge() {
        int min = CommonConstant.TWO_HUNDRED;
        int max = CommonConstant.FIVE_HUNDRED;
        int randomNumber = ThreadLocalRandom.current().nextInt(max - min + 1) + min;
        return randomNumber;
    }

    /**
     * 获取2-3之间的一个整行随机数
     * @return
     */
    public static int getRandomIntMinute() {
        int min = CommonConstant.TWO;
        int max = CommonConstant.THREE;
        int randomNumber = ThreadLocalRandom.current().nextInt(max - min + 1) + min;
        return randomNumber;
    }

    public static void main(String[] args) {
        System.out.println(getRandomIntMinute());
    }
}
