title: Why does this while loop never stops in Python
body: <p>I am trying to generate a list of 100 unique random numbers using Python 3.8. For this I am using the following block of code:</p>
  <pre><code>import random
  
  list_1_unique = [random.randint(0,30)]
  
  
  for i in range(1, 100):
      x = random.randint(0, 30)
      while x in list_1_unique:
          x = random.randint(0, 30)
      list_1_unique.append(x)
      
  list_1_unique
  </code></pre>
  <p>But once I run it Ipython console never stops, so it enters in eternal loop and I do not understand why? Can anybody guess why?</p>