PHP function to generate a random string from a customizable character pool.