Random color generation class

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.