title: How to generate independent identically distributed (iid) random variables in python
body: <p>I am developing a simulation infrastructure with some random events (for instance, sources that generate output with a certain probability). So far I've been doing it using the random.random() function. Ex:</p>
  
  <pre><code>class source:
      def output(self, x):
          if(random.random()&lt;=x):
              return foo
  a = []
  for i in xrange(10)
      a.append(source())
  
  for i in xrange(1000):
      for j in xrange(len(a)):
          a[j].output()
  </code></pre>
  
  <p>From what I understand, all of the sources in my list "a" will get random numbers from the same pseudo-random LFSR source, so a[0] will get a sample, then a[1] will get the next one, then a[2], etc. If random.ramdom() generated a truly random sequence, I believe this would still generate 10 iid subsets of values, however, since I am assuming that python uses an LFSR, or a similar scheme, where each subsequent sample depends on the previous sample, taking several subsets of these samples may or may not be independent and identically distributed. </p>
  
  <p>I have two questions:</p>
  
  <ol>
  <li>What kind of distributions do I actually get using my pseudocode or something similar to that</li>
  <li>How do I get several iid random variables in python?</li>
  </ol>
  
  <p>I looked at other stack overflow posts, like this one for example:
  <a href="https://stackoverflow.com/questions/24204582/generate-multiple-independent-random-streams-in-python">Generate multiple independent random streams in python</a>
  but they don't answer my question.</p>