If it doesn't matter where Red is then you can start with Red and pick 2 other colours right? The problem here is not picking the same one twice which I usually resolve with an array. You can push all colours into an array and select one at random, then delete the row so it's not picked again. Then select another one at random.