byte segmentPin[] = {2, 3, 5, 9, 10, 12, 11, 4};
int numeral[10][8] = {
  //                          num   segs
  {1, 1, 1, 1, 1, 1, 0, 0}, // 0 // 0xFC
  {0, 1, 1, 0, 0, 0, 0, 0}, // 1 // 0x60
  {1, 1, 0, 1, 1, 0, 1, 0}, // 2 // 0xDA
  {1, 1, 1, 1, 0, 0, 1, 0}, // 3 // 0xF2
  {0, 1, 1, 0, 0, 1, 1, 0}, // 4 // 0x66
  {1, 0, 1, 1, 0, 1, 1, 0}, // 5 // 0xB6
  {1, 0, 1, 1, 1, 1, 1, 0}, // 6 // 0xBE
  {1, 1, 1, 0, 0, 0, 0, 0}, // 7 // 0xE0
  {1, 1, 1, 1, 1, 1, 1, 0}, // 8 // 0xFE
  {1, 1, 1, 1, 0, 1, 1, 0}  // 9 // 0xF6
};

void setup() {
  randomSeed(analogRead(A0));
  for (int i = 0; i < 8; i++) {
    pinMode(segmentPin[i], OUTPUT);
  }
}

void loop() {
  // count();
  // sequence();
  randomOn();
}

void count() {
  for (int i = 0; i < 10; i++) {
    for (int j = 0; j < 8; j++) {
      digitalWrite(segmentPin[j], numeral[i][j]);
    }
    delay(498);
    // clear();
    digitalWrite(segmentPin[7], HIGH);
    delay(498);
  }
}

void sequence() {
  for (int i = 0; i < 8; i++) {
    digitalWrite(segmentPin[i], HIGH);
    delay(250);
  }
  clear();
}

void randomOn() {
  byte i = random(8);
  digitalWrite(segmentPin[i], HIGH);
  delay(250);
  digitalWrite(segmentPin[i], LOW);
}

//**************************************************
// UTILITIES
//**************************************************
void clear() {
  for (int i = 0; i < 8; i++) {
    digitalWrite(segmentPin[i], LOW);
  }
}

void set() {
  for (int i = 0; i < 8; i++) {
    digitalWrite(segmentPin[i], HIGH);
  }
}
NOCOMNCVCCGNDINLED1PWRRelay Module
NOCOMNCVCCGNDINLED1PWRRelay Module
NOCOMNCVCCGNDINLED1PWRRelay Module
NOCOMNCVCCGNDINLED1PWRRelay Module
NOCOMNCVCCGNDINLED1PWRRelay Module
NOCOMNCVCCGNDINLED1PWRRelay Module
NOCOMNCVCCGNDINLED1PWRRelay Module
NOCOMNCVCCGNDINLED1PWRRelay Module