long n;
int button = 8;     
int led = 2;

void setup(){
  Serial.begin(9600);
  pinMode(led, OUTPUT);      
  pinMode(button, INPUT);     
  randomSeed(analogRead(5));
}

void loop() {
  if (digitalRead(button) == HIGH) { 
    n = random(1,7);
    Serial.println(n);  
    for(int t=1;t<=n;t++){
      delay(300); 
      digitalWrite(led, HIGH);   
      delay(300);               
      digitalWrite(led, LOW);                  
    }
  }
}
