Random function

You generally seed the random number once (outside of the loop). But, that shouldn't be causing you a problem since you are seeding the random generate with a diferent value each time.

I agree that it makes more sense to randomly choose the HIGH/LOW (1/0) state randomly, rather than choosing the pins randomly.

I don't think you need a random number for the pin at all... You can simply write random data to ALL of the pins/LEDs every time through the loop, to pop-up a random pattern each time through the loop (if that's what your're trying to do).

Unless, you wanted to change only one pin each time through the loop. Then, you might want to randomly choose the one-pin to be "active" each time. If you do that, you'll only get a change about half the time, randomly... :wink:

P.S.
I dont know what your goal is, but once you get this working you might want to make one more enhancement...

Since there are 8 different possible "patterns", you are going to get a "repeat" about once per second (randomly)... i.e. you'll get the same pattern twice in a row... so on-average, you'll only get about 9 "changes" per second (instead of the expected 10), and it's going to "look like" a glitch or a pause. If that's a problem, you might want to look for that and skip the delay if you get the same pattern twice in a row.

If there are any other "invalid" states like all-on, or all-off, you can check for that too, and start the loop over if you get something invalid.