title: How to test for uniformity
body: <p>I simulate times in the range <code>0</code> to T according to a Poisson process.  The inter-event times are exponential and we know that the distribution of the times should be uniform in the range <code>0</code> to <code>T</code>.</p>
  
  <pre><code>def poisson_simul(rate, T):
      time = random.expovariate(rate)
      times = [0]
      while (times[-1] &lt; T):
          times.append(time+times[-1])
          time = random.expovariate(rate)
      return times[1:]
  </code></pre>
  
  <p>I would simply like to run one of the tests for uniformity, for example the Kolmogorov-Smirnov test. I can't work out how to do this in scipy however. If I do</p>
  
  <pre><code>import random
  from scipy.stats import kstest
  times = poisson_simul(1, 100)
  print kstest(times, "uniform") 
  </code></pre>
  
  <p>it is not right . It gives me</p>
  
  <pre><code>(1.0, 0.0)
  </code></pre>
  
  <p>I just want to test the hypothesis that the points are uniformly chosen from the range <code>0</code> to <code>T</code>. How do you do this in scipy?</p>