from abduct:
that code snippet your teacher gave you does not help your problem in any way. it is simply generating random characters in either the a-z or 1-9 keyspace. it will still generate the same numbers over and over again.
you have two detailed posts that offer two solutions to this problem. the first although less efficient is easier to read than the latter. the two functions you need to look at are `getnextpassword` and `bruteforce` respectivly.
the essential parts of the function you need to make are
Code
break the current password to increment into an array
loop through the array until the end
if the current character in the current index of the arrays ordinal/ascii value is larger or equal to 126 '~'
reset the current index to the bottom of your keyspace, the character reprisation of 33 '!'
else
exit the loop if the current indexes ordinal/ascii value is equal to 126, meaning that this is the last character and should not try to incrment it
store the current ordinal/ascii value to a temperary value
increment the temperary value by 1 and assign it to the current index we are working with
break from the loop so that we dont modify other values
return the array as a joined string
this is not the only way to stop your application from generating duplicate guesses but it is the simplest, and other ways require mathamatics to go through one line of linear guesses, then you have to adjust it to go through another linear line of guesses that doesnt duplicate already made guesses.
i suggest you take a break from this project to learn the language some more before attempting this. it seems you have a limited knowledge of your syntax and any psudo code/logic we post will be to much for you to translate into working code.
Create a new paste based on this one