Skip to content

Instantly share code, notes, and snippets.

@JokerMartini
Created December 18, 2015 12:03
Show Gist options
  • Save JokerMartini/6a15b3851f6eea71766c to your computer and use it in GitHub Desktop.
Save JokerMartini/6a15b3851f6eea71766c to your computer and use it in GitHub Desktop.
C#: Generations a random color in C#.
public class RandomColorGenerator {
Random r = new Random(DateTime.Now.Millisecond);
public RandomColorGenerator(){
}
public Color RandomColor(){
byte red = (byte)r.Next(0, 255);
byte green = (byte)r.Next(0, 255);
byte blue = (byte)r.Next(0, 255);
return new Color(red, green, blue);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment