title: Python random string/text/code generator with fixed length and some characters
body: <p>So, a few years ago I have found an exploit in the giftcard system at McDonalds. The basic point is by combining about 15-20 cards, and their codes, I got a point that 3rd and the 7th characters are the same while the others are completely random.</p>
  
  <p>I might have found the same thing in the new Coke festival that is taken in my area (Turkey). I just wanted to ask, how can I develop a code with random module that it will randomly create codes by going over a specific algorithm, for example let's go with the same 3rd and 7th characters again.</p>
  
  <p>By keeping them, randomly generate 8 numbered/lettered codes. Also I think using the while True would be better to generate like infinite amount of them. I will finally add them into a list. However, I need help in the middle part.</p>
  
  <pre><code>import random
  import string
  
  def randomStringDigits(stringLength=6):
      lettersAndDigits = string.ascii_letters + string.digits
      return ''.join(random.choice(lettersAndDigits) for i in range(stringLength))
  
  print ("Generating a Random String including letters and digits")
  while True:
      print ("First Random String is  ", randomStringDigits(8))
  </code></pre>