I’m using a graphing package that can draw lines of color (255,255,255).
So basically what I’m doing is (Random.Next(0,255),Random.Next(0,255),Random.Next(0,255)) to generate a color each time a line is added.
This is all well and good, but sometimes, I get colors that look very similar, making it difficult for the user to discern which data corresponds to which line.
Is there a more clever way to generate random and unique colors in the (255,255,255) format?
A better option is to typically generate a random hue, and the convert the hue to an RGB color using an HSL or HSV color (with that hue). By using a random “hue” instead of random color, you’ll get much more variation in your colors. You can also randomize the other components (saturation/value, etc), if you need even more variation.
See Wikipedia for details on working in colors using HSV/HSL, including how to convert HSV to RGB.