title: Generating random number with different digits
body: <p>So I need to write a program which generates random numbers from 100 to 999, and the tricky part is that the digits in the number <strong>can't</strong> be the same.</p>
  
  <p>For example: <code>222</code>, <code>212</code> and so on are not allowed.</p>
  
  <p>So far, I have this:</p>
  
  <pre><code>import random
  
  a = int (random.randint(1,9)) &lt;-- first digit
  b = int (random.randint(0,9)) &lt;-- second digit
  c = int (random.randint(0,9)) &lt;-- third digit
  
  if (a != b and a != b and b != c):
      print a,b,c
  </code></pre>
  
  <p>As you can see, I generate all three digits separately. I think it's easier to check if there are same digits in the number.</p>
  
  <p>So, now I want to do a loop that will generate the numbers until the requirements are met (now it either prints blank page or the number). Note that it generates only once and I have to open the program again.</p>
  
  <p>In C++ I did that with the '<strong><em>while loop</em></strong>'. And here I don't know how to do it.</p>
  
  <p>And one more question. How can I code the number(quantity) of random numbers I want to generate? 
  To be more specific:
  I want to generate 4 random numbers. How should I code it?</p>
  
  <p><strong>P.S.</strong>
  <em>Thank you all for your answers and suggestions, I am really keen on learning new techniques and codes.</em> </p>