Click here to Skip to main content
Click here to Skip to main content
Alternative Tip/Trick

Tagged as

Random Color Generator

, 15 Sep 2011 CPOL
Rate this:
Please Sign up or sign in to vote.
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

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


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


About the Author


United States United States
No Biography provided

Comments and Discussions

GeneralReason for my vote of 4 Good, but considering its C should... PinmemberBrianBissell20-Sep-11 4:16 
GeneralA good point. I very rarely comment on CodeProject articles... Pinmemberflector15-Sep-11 12:23 
GeneralHello Flector, I think you should not create alternative fo... PinmemberEric Ouellet15-Sep-11 11:35 
GeneralThanks, you are right. This is the easiest method. But it di... PinmemberEric Ouellet15-Sep-11 11:10 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.150123.1 | Last Updated 15 Sep 2011
Article Copyright 2011 by flector
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid