Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Generating a Random Color in C#
#1
Here is a helpful code snippit that I converted to C# from Brandon's post in the Java forum.

This method returns a color with random red, green, and blue values.

Pastebin: http://pastebin.com/PceciHEE

[code2=csharp]//This method returns a color with random red, green, and blue values

public Color getRandomColor()
{
Random random = new Random();
return Color.FromArgb(random.Next(256), random.Next(256), random.Next(256));
}[/code2]
#2
Awesome! Thanks for sharing!
My Blog | My Setup | My Videos | Have a wonderful day.
#3
brandonio21 Wrote:Awesome! Thanks for sharing!
No problem!


Forum Jump:


Users browsing this thread: 1 Guest(s)