const int ledPin = 4;           // Define the LED pin
const int minOnTime = 100;      // Minimum time LED is ON in milliseconds
const int maxOnTime = 3000;     // Maximum time LED is ON in milliseconds
const int minOffTime = 50;     // Minimum time LED is OFF in milliseconds
const int maxOffTime = 200;    // Maximum time LED is OFF in milliseconds

unsigned long previousMillis = 0;
int ledState = LOW;
unsigned long onTime = 0;
unsigned long offTime = 0;

void setup() {
  pinMode(ledPin, OUTPUT);
  generateRandomTimes();
}

void loop() {
  unsigned long currentMillis = millis();

  if (ledState == LOW) {
    if (currentMillis - previousMillis >= offTime) {
      // Turn the LED on
      ledState = HIGH;
      previousMillis = currentMillis;
      generateRandomTimes();
    }
  } else {
    if (currentMillis - previousMillis >= onTime) {
      // Turn the LED off
      ledState = LOW;
      previousMillis = currentMillis;
      generateRandomTimes();
    }
  }

  digitalWrite(ledPin, ledState);
}

void generateRandomTimes() {
  onTime = random(minOnTime, maxOnTime + 1);    // Generate a random ON time
  offTime = random(minOffTime, maxOffTime + 1); // Generate a random OFF time
}