It is 'legal' but this while loop
while (lastColor_8 == randNumber && lastColor_2 == randNumber) //BINARY 8 & 2
{
randNumber = random(11); // Generate a new (color) randNumber
}
will do nothing unless lastColor_8 and lastColor_2 both happen to equal the already existing value of randNumber when it starts, and even then it will end almost immediately because the condition will become false in most cases straight away.
Can you explain what it is supposed to do and how ?