9
You could simply create an array of all potential characters then randomly pick out however many you want and return them as the URL "code"?
$arr = array('a','b','c','d');
$count = count($arr) - 1;
$str = $arr[rand(0, $coun)].$arr[rand(0, $coun)];