How would I simplify this?

This is how I might have written it:

const unsigned long int displayInterval = 500;  //500ms delay for the number

const int buttonPin = 10; //button pin to display the dice

const int pinArray[] = { 2, 3, 4, 5, 6, 7, 8, 9};
const int pinCount = sizeof pinArray / sizeof pinArray[0];

void setup() {
  for (int i=0; i<pinCount; i++)
    pinMode(pinArray[i], OUTPUT);
}

void loop() {
  if(digitalRead(buttonPin)) //checks if button is pressed
    LED(); //call LED function
}


void LED() {
  int num = random(1,9); //generate random number

  for (int i=0; i<num; i++)
    digitalWrite(pinArray[i], HIGH);
  delay(displayInterval);
  for (int i=0; i<pinCount; i++)
    digitalWrite(pinArray[i], LOW);
}

If you have any questions about the various design decisions, just ask.