```
srand((unsigned) time(NULL));
```

Initialises a random number generator.```
const int passLen = 10;
for (int i = 0; i < passLen; i++) {
```

Makes the code generate 10 characters```
cout << (char) (rand() % ('z' - '0' + 1) + '0');
```

Does teh actual work.The cout stuff I assume you understand.

rand() generates a new random number.

% Modulus operator - effectively limits the random number to between zero and the second parameter minus one.

'z' - '0' + 1 The second parameter, sets upper limit of the range of characters.

+ '0' Converts the result to a printable ASCII character - it the random number is 0, then '0', if it is one, the '1', if it is nine then '9', if it is ten then ':' - see here http://www.asciitable.com/[^] for the Ascii characters and you will see what I mean.

The second parameter is just saying "I want my results to be between '0' and 'z', so give me value that is the difference plus one" - because the one will be discarded by the modulus operation. if it was '0' to '9' then it would be 57 - 48 + 1 which is (obviously) 10 - so teh random number would be 0 to 9 inclusive.