im trying to make a random color generator but i dont want similar colors to show up in the arrayList
public class RandomColorGen {
public static Color RandColor() {
Random rand = new Random();
float r = rand.nextFloat();
float g = rand.nextFloat();
float b = rand.nextFloat();
Color c = new Color(r, g, b, 1);
return c;
}
public static ArrayList<Color> ColorList(int numOfColors) {
ArrayList<Color> colorList = new ArrayList<Color>();
for (int i = 0; i < numOfColors; i++) {
Color c = RandColor();
if(similarcolors){
dont add
}
colorList.add(c);
}
return colorList;
}
}
I'm really confused please help :)
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…