A consequence of being an auto regressive model is not being able to plan token output. I think the author’s example is one of the many corollaries.
You could prompt the LLM differently , for example to write a Python program that does the random part, and then act on its output.