Arduino C, Led > binary alternative all lights
Code review (one possible solution can be found below) 


Absolute numbers in the code, like 15 as the limit for the random numbers are generally considered harmful. It would be better to give all absolute numbers a constantsname and use these throughout. The OP code did not use the constants for the pins, for instance. 
Writing similar pieces of code in a row makes maintenance hard. Therefore, group similar items in any kind of list, like an array, and iterate over them. 
Functions should have expressive names clearly stating what is going on inside. 
Functions should be short and concise, ideally having only a few lines. 


Try something along these lines: 

// setting the number of bits to analyze, corresponding pins and corresponding powers of two.
// the latter is here for instructional purposes although it is redundant. 
const int numberOfBits = 4;
const int randLimit = 15;   // 2^(1+numberOfBits)-1 actually;
int ledPins[numberOfBits] = {13, 8, 12, 7};
int bitValue[numberOfBits] = {8, 4, 2, 1}; // the powers of two

void turnOffAllLeds ()
{
  Serial.println ("turning all off");
  for (int i = 0; i &lt; numberOfBits; i++)
  {
    digitalWrite (ledPins[i], LOW);
  }
}

void selectivelyTurnOnLeds(int value)
{
  turnOffAllLeds ();

  // now for each bit, check if it is set in the value, if yes: turn on corresponding led
  for (int i = 0; i &lt; numberOfBits; i++)
  {
    if ((value &amp; bitValue[i]) &gt; 0)
    {
      digitalWrite (ledPins[i], HIGH);
    }
  }
}

void setup() 
{
  for (int i = 0; i &lt; numberOfBits; i++)
  {
    pinMode (ledPins[i], OUTPUT);
  }
}

void loop() 
{
  selectivelyTurnOnLeds (random (randLimit));
  delay (1000);
}                                                                            


P.S. When posting a question, please also post what your code is supposed to do. If it were not for a lazy prechristmas workday, I would not have taken the time to reverse engineer your code.