title: Python lagged Fibonacci generator
body: <p>I am trying to write a program in Python to compute a sequence of pseudorandom numbers using the lagged Fibonacci method. I want to generate 2000 numbers in the range (0, 2**32) and then plot <code>x_i</code> against <code>x_i-1</code>. I have: </p>
  
  <pre><code>def lag(s):
      for i in range(k):
          if i is 0:
              out = (s[j-1] + s[k-1]) % m
          elif 0 &lt; i &lt; k - 1:
              s[i] = s[i+1]
          else:
              s[i] = out
              print(s[i])
  j, k, m = 7, 10, 2**32
  
  X=[1]
  
  for n in range(2000):
      X.append(lag(X[-1]))
      y = X[:]
      y.append(y[0])
      del y[0]
  
  import matplotlib.pyplot as plt
  plt.plot(X, y, '.')
  </code></pre>
  
  <p>When I run the program I get the error </p>
  
  <blockquote>
  <pre><code>out = (s[j-1] + s[k-1]) % m
  TypeError: 'int' object is not subscriptable
  </code></pre>
  </blockquote>
  
  <p>I'm not sure what this error means or how to fix it. Can anyone help?</p>