"What stops mysql from taking rand as a column position"
the fact that it says "rand()" and not "1" or "2"
"if I want to place a function as the order by clause how does mysql know the result is not the order by criteria but the column name/alias/number"
Again, becuase it doesn't say "1" or "2" or any other number.
"I think getting the record count of a table(very fast in mysql), generating a random number(very fast in php) on that interval and fetching a row who's ordinal position is the same random number is much faster"
two queries is nearly always slower than one.
it is very difficult to come up with a query that executes slower than it's PHP counterpart. Try it.