title: How to prevent random.sample from generating the same combination of number again?
body: <p>I just wanted to know if there's a way to stop the random.sample from generating the same combination again in list.</p>
  <p>So for example combination [4, 6, 1] already appeared in random.sample then I don't want it to appear again to make the matching of my variable code faster.</p>
  <p>Thanks</p>
  <pre><code>import random
  
  code = [2, 6, 4]
  
  while True:
      rand = random.sample(range(0, 10), 3)
      if(rand == code):
          print(str(rand) + &quot; access granted&quot;)
          break
      else:
          print(str(rand) + &quot;access denied&quot;)
  </code></pre>