number generator show wrong segments on 7 segment display
Note, this is not an answer to your question, but I like to show some programming improvements, making your sketch  much shorter and easier to maintain.

Instead of having all functions one, two, etcetera, use a parameter to pass the number. So you get this: (I couldn't test it as I don't have an Arduino IDE at hand). Also you can use a for loop in the loop function to set the output pins.

int num_array[11][7] = {
  { 1, 1, 1, 1, 1, 0, 1 }, // 0
  { 0, 1, 1, 0, 0, 0, 0 }, // 1
  { 1, 1, 0, 1, 1, 1, 0 }, // 2
  { 1, 1, 1, 1, 0, 1, 0 }, // 3
  { 0, 1, 1, 0, 0, 1, 1 }, // 4
  { 1, 0, 1, 1, 0, 1, 1 }, // 5
  { 1, 0, 1, 1, 1, 1, 1 }, // 6
  { 1, 1, 1, 0, 0, 0, 0 }, // 7
  { 1, 1, 1, 1, 1, 1, 1 }, // 8
  { 1, 1, 1, 0, 0, 1, 1 }, // 9
  { 0, 0, 0, 0, 0, 0, 0 }
};  //OFF

int buttonState = 0;
const int button = 12;
int randVal;
bool pressVal;

void num_Write(int);
void digit(int value);

void setup() {
  Serial.begin(9600);

  for (int pin = 2; pin &lt;= 8; pin++)
  {
    pinMode(pin, OUTPUT);
  }

  pinMode(button, INPUT);
}

void loop() {
  buttonState = digitalRead(button);
  if (buttonState == LOW) {
    turnOff();
    pressVal = false;

  }
  else
  {
    if (pressVal == false)
    {
      int pin = 2;
      for (int i = 0; i &lt; 7 ; i++)
      {
        digitalWrite(pin++, num_array[11][i]);
      }
      randVal = rand() % 10;
      pressVal = true;
    }
    Serial.println(randVal);
    if ((randVal &gt;= 0) &amp;&amp; (randVal &lt;= 9))
    {
      digit(randVal);
    }
  }
}

void digit(int value)
{
  int pin = 2;
  for (int j = 0; j &lt; 7; j++) {
    digitalWrite(pin++, num_array[value][j]);
  }
  delay(250);
}

void turnOff()
{
  int pin = 2;
  for (int j = 0; j &lt; 7; j++) {
    digitalWrite(pin++, num_array[10][j]);
  }
  delay(250);
}


You can also remove turnOff if you treat it like digit 10 but that is not so clear (or put the implementation of digit to another function and call it from digit and turnoff.

To solve your problem, print the values of each pin to the serial monitor. If they are correct, there is a problem in your circuit. If they are incorrect, there is a problem in your sketch. In the latter case, add more print statements until you found the exact problem.

Update


Fixed void forward declaration to function call (see comment of chrisl)


If the digit function is never called, it means:


((randVal &gt;= 0) &amp;&amp; (randVal &lt;= 9)) is false, however, that is not possible since it is initialized to 0 and with the rand function it gets always values between 0 to 9.
pressVal is always TRUE.


So check the value of pressVal, also add (lots of) print statements, especiallya after each if and else so you know exactly the flow of your sketch. You will see it's very easy to find the error. If you pinpoint the problem to a digitalRead that is not the expected value, THAN there is high likely a problem with your circuit (a button that is never going to be LOW or HIGH). In that case, you probably forgot a pullup/pulldown resistor.