I made a simple program in Python to generate a random string with 5 numbers in it:
import random
numcount = 5
fstring = ""
for num in range(19): #strings are 19 characters long
if random.randint(0, 1) == 1:
x = random.randint(1, 26)
x += 96
fstring += (chr(x).upper())
elif not numcount == 0:
x = random.randint(0, 9)
fstring += str(x)
numcount -= 1
print(fstring)
Not too hard, right? Except for one incredibly strange thing: the strings it returns are of a random length. I have run the code several times, and here are some of my results:
>>> ================================ RESTART ================================
>>>
VQZ99HA5DER0CES4
>>> ================================ RESTART ================================
>>>
05PS0T86LOZS
>>> ================================ RESTART ================================
>>>
E2QX8296XK
>>> ================================ RESTART ================================
>>>
M5X9K457QDNBPX
I can't figure out what's going on... Can anyone point me in the right direction?