Randomly blink without delay?

Hi Guys,

I've been searching for a way to randomly blink without using delay.
Theres a few codes about to blink without delay, but it seems the only way to randomize this blinking (randomly on/off between a set of values) is with the delay function.

This is the blink without delay code: // http://www.arduino.cc/en/Tutorial/BlinkWithoutDelay

// constants won't change. Used here to 
// set pin numbers:
const int ledPin =  9;      // the number of the LED pin

// Variables will change:
int ledState = LOW;             // ledState used to set the LED
long previousMillis = 0;        // will store last time LED was updated

// the follow variables is a long because the time, measured in miliseconds,
// will quickly become a bigger number than can be stored in an int.
long interval = 1000;           // interval at which to blink (milliseconds)

void setup() {
  // set the digital pin as output:
  pinMode(ledPin, OUTPUT);      
}

void loop()
{
  // here is where you'd put code that needs to be running all the time.

  // check to see if it's time to blink the LED; that is, if the 
  // difference between the current time and last time you blinked 
  // the LED is bigger than the interval at which you want to 
  // blink the LED.
  unsigned long currentMillis = millis();
 
  if(currentMillis - previousMillis > interval) {
    // save the last time you blinked the LED 
    previousMillis = currentMillis;   

    // if the LED is off turn it on and vice-versa:
    if (ledState == LOW)
      ledState = HIGH;
    else
      ledState = LOW;

    // set the LED with the ledState of the variable:
    digitalWrite(ledPin, ledState);
  }
}

Do you know if this is possible? If so, how?

For the bigger picture - I want a few LED's to randomly blink on/off as a general state, untill someone gets close to them. Then have an LDR sensor, so that when people approach the light, they stop flickering, and stay on dimmed, gradually getting brighter, the closer (less light) someone gets.

I've got the stages in separate codes, but I'm having trouble combining them together.

Cheers

but it seems the only way to randomize this blinking (randomly on/off between a set of values) is with the delay function.

Use the blink-without delay tutorial, but instead of the fixed interval ("interval = 1000"), use a value returned (and possibly scaled) by "random".

oh thanks,

so how would this be written?

sorry - having trouble getting to grips with the arduino language...

http://arduino.cc/en/Reference/Random

sweet, that's great!!

THANKSS