RandomUtil.java
571 Bytes
package com.topdraw.util;
import java.util.Random;
public class RandomUtil {
/**
* 获取随机积分
* @param max
* @param min
* @return
*/
public static Long getRandomPoints(Integer min,Integer max) {
Random random = new Random();
int s = random.nextInt(max)%(max-min+1) + min;
return Long.valueOf(s);
}
public static void main(String[] args) {
for (int i=0;i<30;i++) {
long randomPoints = getRandomPoints(1, 10);
System.out.println(randomPoints);
}
}
}