[Python] Random password generator. 02-19-2013, 01:12 PM
#1
Code:
import random
def passgen(x):
char='abcdefghijklmnopqrstuvwxzy'
charup='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
nums='0123456789'
sym='!@#$%^&*()_+-=,<.>/?;:"{[}]|'
password=''
while len(password)!=x:
if random.randrange(0,100)/2==0:
password+=char[random.randrange(0,26)]
elif random.randrange(0,100)/2==0:
password+=charup[random.randrange(0,26)]
elif random.randrange(0,100)/2==0:
password+=nums[random.randrange(0,9)]
elif random.randrange(0,100)/2==0:
password+=sym[random.randrange(0,28)]
return password
print(passgen(10))![[Image: fow57.jpg]](http://i.imgur.com/fow57.jpg)

![[+]](https://sinister.li/images/modern/collapse_collapsed.png)
![[Image: 2YpkRjy.png]](http://i.imgur.com/2YpkRjy.png)



![[Image: 4180_gif_by_d53865-d31l0il.gif]](http://fc06.deviantart.net/fs70/f/2010/299/7/7/4180_gif_by_d53865-d31l0il.gif)