Java Random Color getRandomColor()

Here you can find the source of getRandomColor()

Description

get Random Color

License

Open Source License

Declaration

public static byte getRandomColor() 

Method Source Code

//package com.java2s;
/*/*from w  ww . j a v a2 s .  c o  m*/
 * BleedingMobs - make your monsters and players bleed
 *
 * Copyright (C) 2011-2012 snowleo
 *
 * This program is free software: you can redistribute it and/or modify it under
 * the terms of the GNU General Public License as published by the Free Software
 * Foundation, either version 3 of the License, or (at your option) any later
 * version.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along with
 * this program. If not, see <http://www.gnu.org/licenses/>.
 */

import java.util.Random;

public class Main {
    private static final Random RANDOM = new Random();

    public static byte getRandomColor() {
        // 1 2 3 4 5 6 9 10 11 13 14
        int color = 1 + RANDOM.nextInt(11);
        color = color > 6 ? color + 2 : color;
        color = color > 11 ? color + 1 : color;
        return (byte) color;
    }
}

Related

  1. getRandomColor()
  2. getRandomColor()
  3. getRandomColor()
  4. GetRandomColor()
  5. getRandomColor()
  6. getRandomColor()
  7. getRandomColor()
  8. getRandomColor()
  9. getRandomColor()