assigning variables a random value question

In the code I have two variables r and c, I assign them a random number by saying r = random( 8 ) then c = random( 8 ). This leads me to two questions:

  1. are they being assigned two different random numbers or the same random number per iteration of the loop?
  2. how is this turning on only one led of an 8x8 led matrix at a time if they are different random numbers? shouldn't the row be just the NOT version of the column (ex, B00100000 and B11011111) this would turn on only 1 led.

I am just really confused as to what is happening here

#define DS 6  // connect to pin 14 on the 74HC595
#define ST_CP 8  // connect to pin 12 on the 74HC595 (LATCH)
#define SH_CP 10  // connect to pin 11 on the 74HC595 (CLOCK)

int binary[] = {1, 2, 4, 8, 16, 32, 64, 128};
int r = 0;
int c = 0;

void setup()
{
  pinMode(DS, OUTPUT);
  pinMode(ST_CP, OUTPUT);
  pinMode(SH_CP, OUTPUT);
  randomSeed(analogRead(0));
}

void setLED(int row, int column, int del)
{
  digitalWrite(ST_CP, LOW);
  shiftOut(DS, SH_CP, LSBFIRST, binary[column]);
  shiftOut(DS, SH_CP, LSBFIRST, ~binary[row]);
  digitalWrite(ST_CP, HIGH);
  delay(del);
}

void loop()
{
  r = random(8);
  c = random(8);
  setLED(r, c, 1); 
}
setLED( 1 << random(8),  _BV(random(8)), 1);

You are using one of them for the row and the other for the column. That's just one LED in your matrix isn't it?

  1. are they being assigned two different random numbers or the same random number per iteration of the loop?

Two different numbers.

  1. how is this turning on only one led of an 8x8 led matrix at a time if they are different random numbers?

How many LEDs are at the intersection of the row and column? Most matrices have one LED at each intersection.