Java Random Color getRandom()

Here you can find the source of getRandom()

Description

get Random

License

Open Source License

Declaration

public static Color getRandom() 

Method Source Code


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

import java.awt.Color;

public class Main {
    public static Color getRandom() {
        int r = randomInt(256), //
                g = randomInt(256), //
                b = randomInt(256);/*w  w w  . j  a v  a 2 s .  c  o m*/
        return new Color(r, g, b);
    }

    private static int randomInt(int n) {
        return (int) (Math.random() * n);
    }
}

Related

  1. getRandColor(int fc, int bc)
  2. getRandColor(int fc, int bc)
  3. getRandColor(int fc, int bc)
  4. getRandomColor()
  5. getRandomColor()
  6. getRandomColor()
  7. getRandomColor()