AI's can write deterministic code and have been doing so for a while. Humans do this as well. We write deterministic code with a goal, and generally it works out okay.
If you say that you can't trust AI because LLM's are statistical models, that's a true statement. Though it also turns out that we don't trust humans to write code correct either, which is why we have code reviews.