I want to generate some random colors in wpf and store them in an array.
Random r;
Color[] colarr = new Color[6];
for (int i = 0; i < colarr.Length; i++)
{
Color c=new Color();
r=new Random();
r.Next();
c.R = (byte)r.Next(1, 255);
c.G = (byte)r.Next(1, 255);
c.B = (byte)r.Next(1, 255);
c.A = (byte)r.Next(1, 255);
c.B = (byte)r.Next(1, 255);
colarr[i] = c;
}
but all the elements of the array represent one single color. When I debugged the code, I found random colors for every element, but when the code is executed(not in debug mode) same color is generated. This makes clear that the code is correct, there is some problem while execution.
EDIT :
How can I increase the randomness of the colors generated?