生成指定範圍的隨機數

public class RandomUtil {

    private static final Logger log= LoggerFactory.getLogger(RandomUtil.class);

    public static int getRandomValue(int min,int max){
        Random random=new Random();
        int randNumber =random.nextInt(max - min + 1) + min;
        return randNumber;
    }
}
相關文章
相關標籤/搜索