Typically hash's are calculated using something like: $hash = sha1($password."secretcode".$username); - none of which are random.
If you were to add a random number into that like this: $rand = rand(1,99); $hash = sha1($password.$rand);
Now you can't do if($hash1 = $hash2) { loginSuccess(); } because you will never know what random salt was generated for the original hash.