title: Unit testing a method with random behaviour
body: <p>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:</p>
  
  <ol>
  <li>Since the player is positioned randomly, I cannot be sure that a test case that passes once will pass again. For example, it could pass most of the time, but fail if the player happens to be positioned in front of an obstacle.</li>
  <li>I have to test all situations in one test case. For example, when testing whether the player moves correctly, I have to check whether there was an obstacle and if it was considered by the algorithm.</li>
  </ol>
  
  <p>I'm not really happy with that, but I don't see a way out. Is it acceptable to test methods with partially random behaviour?</p>