A class is implemented to generate random colors for plotting.
the principle is to use the random number generator random class to obtain the four components of the color, Alpha, red, green, and blue, and then use the color. fromargb method to synthesize the color.
the randomcolor class has three different constructor types:
Public randomcolor ()
Public randomcolor (INT seed)
Public randomcolor (INT seed, int minalpha, int maxalpha, int minred, int maxred, int mingreen, int maxgreen, int minblue, int maxblue)
seed is the seed for generating random numbers. minxxx and maxxxx are the minimum and maximum values of a certain color.
there are two public methods:
Public color getrandomcolor (); // obtain a random color.
Public color [] getrandomcolorarray (INT count ); // obtain a set of random colors.
Usage:
Randomcolor rc = new randomcolor ();
Color onecolor = RC. getrandomcolor ();
Color [] colorarray = RC. getrandomcolorarray (5 );
Please download at the following linkSource code.
/Files/xrwang/randomcolor/randomcolor.rar