Click here to Skip to main content
11,645,033 members (63,516 online)
Click here to Skip to main content

Tagged as

Random Color Generator

, 2 Oct 2011 CPOL 4K
Rnd() For Red, Green, Blue values. Then convert to ARGB.


Members may post updates or alternatives to this current article in order to show different approaches or add new features.

5 Oct 2011
17 Jun 2014
Eric Ouellet
4 alternatives  
15 Sep 2011
Easy HTML random color generator code (in C++):srand (time(NULL));TCHAR rand_color[10];wsprintf (rand_color, L"#%02x%02x%02x", rand()%255, rand()%255, rand()%255);//rand_color is now a random html color code in text
5 Oct 2011
Eric, sorry for the confusion, I think I wrote it too quick:Guillaume's library uses sRGB with D65 white ref. If you want to continue using that conversion, then just copy/paste RGBtoXYZ and XYZtoRGB into your get a correct codethe calculation is more precise with the expanded...


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Anshul R
India India
No Biography provided

| | Privacy | Terms of Use | Mobile
Web04 | 2.8.150731.1 | Last Updated 2 Oct 2011
Article Copyright 2011 by Anshul R
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid