生成指定范围的随机数

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;
    }
}

 

posted @ 2018-11-06 13:06  Kero小柯  阅读(194)  评论(0编辑  收藏  举报