a helper method that generates a random string