import java.util.Random;
public class Rand {
private static Random rnd = new Random();
/*От 0 до max*/
public static int random(int max) {
return (rnd.nextInt()>>>1)%max;
}
/*От min до max*/
public static int random(int min, int max) {
return min + ((rnd.nextInt() >>> 1)%(max-
min));
}
/*Случайный цвет*/
public static int randomColor() {
return (rnd.nextInt()>>>1)%0xffffff;
}
/*RGB-цвет от min до max*/
public static int random2Color(int min, int
max) {
int r,g,b;
int tmp = max-min;
r = (rnd.nextInt() >>> 1) % tmp;
g = (rnd.nextInt() >>> 1) % tmp;
b = (rnd.nextInt() >>> 1) % tmp;
r+=min; g+=min; b+=min;
return (r << 16) | (g << 8) | b;
}
}