Fixed bug in password generator

Changed for loop to while loop. Perhaps needs done in other methods?
Check.