07-09-2012, 10:49 PM
Just thought that I would share this cool little snippet with you! A random color generator!
Pastebin Version: <!-- m --><a class="postlink" href="http://pastebin.com/CbvuhpG0">http://pastebin.com/CbvuhpG0</a><!-- m -->
[code2=java]//This method is intended to return a random color by generating random
// R,G, and B values (from 0 to 255) using Math.random()
public Color getRandomColor()
{
int randomR = (int) (Math.random() * 256);
int randomG = (int) (Math.random() * 256);
int randomB = (int) (Math.random() * 256);
return new Color(randomR, randomG, randomB); //Return the color
}[/code2]
Pastebin Version: <!-- m --><a class="postlink" href="http://pastebin.com/CbvuhpG0">http://pastebin.com/CbvuhpG0</a><!-- m -->
[code2=java]//This method is intended to return a random color by generating random
// R,G, and B values (from 0 to 255) using Math.random()
public Color getRandomColor()
{
int randomR = (int) (Math.random() * 256);
int randomG = (int) (Math.random() * 256);
int randomB = (int) (Math.random() * 256);
return new Color(randomR, randomG, randomB); //Return the color
}[/code2]