Random Numbers for LED state

Hi,

I am trying to independently control 16 LEDs (or groups of LEDs) with one pushbutton (may actually be several in parallel).

The idea is that every time the pushbutton is pressed, each LED will have a 1 in 3 chance of turning on.

I've tried state = random(2), but no luck.

I used millis() with success for 1 LED, but don't know how I could alter it to control 16.

Thanks!

You will need more hardware so that the arduino can control that many LEDs. You'll want to use a shift register or 2 to help control all of them.

I think that "random (2);" will only generate 0 or 1.
Check it here:
http://www.arduino.cc/en/Reference/Random

this code has no syntax errors, but does not seem to change the "state"

???

void loop()
{
val = digitalRead(BUTTON);

if ((val == HIGH) && (oldval == LOW)) {
state = random(3);
delay(50);
}

oldval = val;

followed by, if state = 0, LED, HIGH, else, LOW

sorry, that code appears to work...

thanks!