Well the function randBetween will return a random integer between 'low' and 'high'. For example if you called it like this:
x would equal a random number between 1 and 6.
int x = randBetween(1, 6);
This is just saying, if you input the same number twice just return that number.
if (low == high) return low;
This code simply swaps around the low and the high values if they were in the wrong order, eg, if low was 6 and high was 1, it would swap them.
if (low > high)
int tmp = low;
low = high;
high = tmp;
This generates the 'seed' which the function rand() requires. It uses the current time so set the seed. Each time rand() is called subsequently, the seed is changed to the next one in the sequence. Look up random number generators if this doesn't make sense.
static bool firstTime = true;
firstTime = false;
This generates the random number and returns it. 'num' gets set to a completely random integer. Then you take the modulus of 'num' and (high - low + 1) to get a number between zero and the difference high - low. Then add 'low' and you have a number between low and high.
int num = rand();
int result = num % (high - low + 1) + low;
and num gets set to 12753 by rand().
(high - low + 1) = 6.
num % 6 = 3 (check with a calculator)
3 + low = 4 and that is the number that gets returned.