I am writing unit test cases for a game I am working on. When the game starts, the player is positioned randomly, and I have two problems with that:
As other answers said, random algorithms are deterministic. you can reproduce a sequence if you use the same seed.
The only situations where I had to deal with a non-deterministic code, is when multithreading was involved. Then, you are dependant on the scheduler of the operating system.
In those cases, I write the unit-test as a loop, that repeats thousand of times the test code.