I think it depends on the engine
Chess Engine Random Tactic Variance
I'm very interested in this question and would love to know more about how randomness fits into contemporary chess engines. I have played around with chess games on my mobile and, for example, most respond to E2-E4 with e7-e5, but sometimes its c7-c6 if I close the app and open it again (rebooting the engine). Are there random variables locked in that stay in place during the session?
If a specific chess engine (such as stockfish) plays against itself does it always play the same game or are there random variations built into its decisions?
I have seen stats for different chess engines playing each other where the outcome varies in each game but if a chess engine plays an identical copy of itself are the moves always identical or does it roll the dice a little with opening moves?