millis with random switching question

From the code, I gather the strategy is to wait a random amount of time (either 100 to 180 milliseconds or 4000 to 5000 milliseconds) and then toggle pin 13. The HIGH time is 100 to 180 milliseconds and the LOW time is 4000 to 5000 milliseconds. Sound about right?

All the "problems" listed above are minor. In other words, there is nothing wrong with how you were approaching the problem. However, I believe there is a simpler approach. Maybe something like this...

void setup() 
{ 
  pinMode(13, OUTPUT);
}

unsigned long delta;
unsigned long previous;

void loop()
{
  unsigned long now;

  now = millis();

  if ( now - previous >= delta )
  {
    digitalWrite(13, ! digitalRead( 13 ) );

    if ( digitalRead( 13 ) )
    {
      // Determine the HIGH time
      delta = random( 100, 180 );
    }
    else
    {
      // Determine the LOW time
      delta = random( 4000, 5000 );
    }
    previous = now;
  }
}