title: What is the difference between Pycrypto's Random.get_random_bytes and a simple random byte generator?
body: <p>I came across this method in <a href="https://www.dlitz.net/software/pycrypto/" rel="noreferrer">Pycrypto</a>, which is used to generate random bytes:</p>
  
  <pre><code>from Crypto import Random
  Random.get_random_bytes(5)
  </code></pre>
  
  <p>I was wondering how this method is different from a simple generator like the following:</p>
  
  <pre><code>import random
  def get_random_bytes(N):
      ASCII = "".join(chr(x) for x in range(255))
      return "".join(random.choice(ASCII) for _ in range(n))
  </code></pre>
  
  <p><strong>Note</strong>: my intuition is that the Pycrypto method is more cryptographically "sound". Looking at <code>random</code>'s documentation, it says that it is based on a generator with a period of <code>2**19937-1</code>. Looking at <code>Random.get_random_bytes</code>, it states that it is capable of generating cryptographically-strong bytes. What does that mean?</p>
  
  <p>Of course, I wish to use the library implementation, instead of my own. I just want to understand the cryptography concepts behind it.</p>