title: How to unit test a pseudo random number generator?
body: <p>I have a pseudo random number generator (PRNG) class that I want to unit test. There are two approaches:</p>
  
  <ol>
  <li>write a test case that takes a large amount of samples and test whether they are properly distributed. This approach may lead to a fairly long execution time for the test case;</li>
  <li>calculate a small series of samples 'by hand' and verify if the PRNG algorithm reproduces it. This approach may lead to a not random sequence being generated without being noticed;</li>
  </ol>
  
  <p>I would say that the first approach is not really unit testing because it does not perform a white box test of the generator, but on the other hand it properly tests the responsibility of the class. The second approach is more like a real unit test, focusing on the algorithm, but it does not provide as much evidence as to whether the class fulfills its responsibility.</p>
  
  <p>Which approach do you prefer, and why?</p>
  
  <hr>