Java Random Color randomColor()

Here you can find the source of randomColor()

Description

random Color

License

Open Source License

Declaration

public static String randomColor() 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    private static final String[] letters = "0123456789ABCDEF".split("");

    public static String randomColor() {
        StringBuilder colorBuilder = new StringBuilder();
        colorBuilder.append('#');
        for (int i = 0; i < 6; i++) {
            Double position = Math.floor(Math.random() * 16);
            colorBuilder.append(letters[position.intValue()]);
        }// ww  w  .  j av  a  2  s  .  c  o m
        return colorBuilder.toString();
    }
}

Related

  1. randomColor()
  2. randomColor()
  3. randomColor()
  4. randomColor()
  5. randomColor()
  6. randomColor()
  7. randomColor(int idx)
  8. randomColor(int seed)
  9. randomColor(Random r)