Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public ArrayList<String> colorArrayGenerator (int numberOfIterations) {
- ArrayList<String> colorArray = new ArrayList<String>();
- for (int i = 0; i < numberOfIterations;i++) {
- int red = (int)(Math.random()*256);
- int green = (int)(Math.random()*256);
- int blue= (int)(Math.random()*256);
- Color randomColor = new Color(red,green,blue);
- Random rand = new Random();
- final float hue = rand.nextFloat();
- final float saturation = 0.9f;//1.0 for brilliant, 0.0 for dull
- final float luminance = 0.5f; //1.0 for brighter, 0.0 for black
- randomColor = Color.getHSBColor(hue, saturation, luminance);
- String hex = String.format("#%02x%02x%02x", randomColor.getRed(), randomColor.getGreen(), randomColor.getBlue());
- colorArray.add(hex);
- }
- return colorArray;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement