Quote:
($direction = " DESC ") && ( int rand (1000) < 500 );This line is assigning DESC to $direction after you've just set it to ASC and then it performs a redundant comparison to see if a random integer below 1000 is lower than 500. I say redundant because it doesn't seem to have any use unless I missed something.
Is that what you intended?