Java Random Color getRandomColor()

Here you can find the source of getRandomColor()

Description

Gets random RGB color

License

Open Source License

Return

Color, random color

Declaration

private static Color getRandomColor() 

Method Source Code


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

import java.awt.Color;

import java.util.Random;

public class Main {
    /**/*ww  w .  j  a  v  a2s  .  co m*/
     * Gets random RGB color
     * @return Color, random color
     */
    private static Color getRandomColor() {
        Random randomGenerator = new Random();
        int r = randomGenerator.nextInt(256);
        int g = randomGenerator.nextInt(256);
        int b = randomGenerator.nextInt(256);
        return new Color(r, g, b);
    }
}

Related

  1. getRandomColor()
  2. getRandomColor()
  3. getRandomColor()
  4. getRandomColor()
  5. getRandomColor()
  6. getRandomColor(boolean useTransparency)
  7. getRandomColor(float offset, float alpha)
  8. getRandomColor(int saturationRandom, float luminance)
  9. getRandomColorInString()