I mean something like:
int r;
int g;
int b;
//define the followin values for a range of grey defined by you
int r_upper_grey = ...;
int r_lower_grey = ...;
int g_upper_grey = ...;
int g_lower_grey = ...;
int b_upper_grey = ...;
int b_lower_grey = ...;
do
{
r= qrand() % 256;
g= qrand() % 256;
b= qrand() % 256;
}while ( ( r < r_upper_grey && r > r_lower_grey) &&
( g < g_upper_grey && g > g_lower_grey) &&
( b < b_upper_grey && b > b_lower_grey) );
int r;
int g;
int b;
//define the followin values for a range of grey defined by you
int r_upper_grey = ...;
int r_lower_grey = ...;
int g_upper_grey = ...;
int g_lower_grey = ...;
int b_upper_grey = ...;
int b_lower_grey = ...;
do
{
r= qrand() % 256;
g= qrand() % 256;
b= qrand() % 256;
}while ( ( r < r_upper_grey && r > r_lower_grey) &&
( g < g_upper_grey && g > g_lower_grey) &&
( b < b_upper_grey && b > b_lower_grey) );
To copy to clipboard, switch view to plain text mode
Get the picture ? Define a range of grey to avoid and keep random the numbers
until they out of the grey zone
Bookmarks