com.gitee.cliveyuan.tools.MathTools Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of java-tools Show documentation
Show all versions of java-tools Show documentation
Some commonly used methods in java
package com.gitee.cliveyuan.tools;
import java.util.Random;
/**
* 数学相关工具
*
* @author clive
* Created on 2018/07/24
* @since 1.0
*/
public class MathTools {
private MathTools(){}
public static int randomInt(int min, int max) {
if (min == max) return min;
Assert.isTrue(min < max, "min must great than max");
Random random = new Random();
return random.nextInt(max) % (max - min + 1) + min;
}
}