I need to generate to generate random colors in Hex values in my asp.net application to draw a graph .
Random random = new Random();
color = String.Format(\"#
Try
Color.FromArgb(random.Next(0, 255), random.Next(0, 255), random.Next(0, 255));
--EDIT--
Update upon mjv's comment:
public class RandomColor
{
Random _random;
public RandomColor()
{
_random = new Random();
}
public Color GetNext()
{
return Color.FromArgb(_random.Next(0, 255), _random.Next(0, 255), _random.Next(0, 255));
}
}
Usage:
colorRandom.GetNext();