c - generate random RGB color using rand() function -
i need function generate 3 numbers can use them rgb pattern svg.
while simple, need make sure i'm not using same color twice. how do that? generate 1 number @ time simple rand (seed time active) , what? don't want exclude number, maybe whole pattern?
i'm kind of lost here.
to precise, first calling of function example 218 199 154 , second i'll 47 212 236 2 different colors. suggestions?
also think struct int r, int g, int b suitable this?
edit: colors should different human eye. sorry not mentioning earlier.
you use set store generated colors. first instanciate new set. then, every time generate color, if value present in set. if record exists, skip , retry new colour. if not, can use dont forget cache in set after. may become not performant if need generate big quantity of colour.
Comments
Post a Comment