title: An efficient way of making a large random bytearray
body: <p>I need to create a large bytearry of a specific size but the size is not known prior to run time.  The bytes need to be fairly random.  The bytearray size may be as small as a few KBs but as large as a several MB.  I do not want to iterate byte-by-byte.  This is too slow -- I need performance similar to numpy.random.  However, I do not have the numpy module available for this project.  Is there something part of a standard python install that will do this?  Or do i need to <a href="http://docs.python.org/extending/">compile my own using C</a>?</p>
  
  <p>for those asking for timings:</p>
  
  <pre><code>&gt;&gt;&gt; timeit.timeit('[random.randint(0,128) for i in xrange(1,100000)]',setup='import random', number=100)
  35.73110193696641
  &gt;&gt;&gt; timeit.timeit('numpy.random.random_integers(0,128,100000)',setup='import numpy', number=100)
  0.5785652013481126
  &gt;&gt;&gt; 
  </code></pre>