Don't forget, it's faster to use bitwise operations when you need a random number that's less than some power of two. For example,
<?php
rand()&1;
// instead of
rand(0,1);
// for generating 0 or 1,
rand()&3;
// instead of
rand(0,3);
// for generating 0, 1, 2, or 3,
rand()&7;
// instead of
rand(0,7)
// for generating 0, 1, 2, 3, 4, 5, 6, or 7,
?>
and so on. All you're doing there is generating a default random number (so PHP doesn't have to parse any arguments) and chopping off the piece that's useful to you (using a bitwise operation which is faster than even basic math).