Created
December 18, 2015 12:03
-
-
Save JokerMartini/6a15b3851f6eea71766c to your computer and use it in GitHub Desktop.
C#: Generations a random color in C#.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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