Line 12: pRan is a pointer that points to the string literal "lhaargpo".
Line 13: Print out the string literal starting from after its 3rd character (skips the l, h, a).
The foo function is just doing some funky math to pick a particular character in a deterministic way.
for i = 0, it calculates (11*0)%8 == 0, so it returns p which is l.
for i = 1, it calculates (11*1)%8 == 3, so it returns p, which is a.
Why multiply by 11 and then mod by 8? I don't see any real rhyme or reason to it, just looks like a contrived example.
The loop then prints each character returned from the function.
Also, to be conforming C++, each char* should be a const char* in your code, since you're pointing to a string literal.
"Sorting" implies some sort of well-agreed comparison between objects. I would say this code is, in a way, shuffling what it prints.