MattX Posted January 14, 2005 Posted January 14, 2005 I have used exsisting code in the help file to generate a random letter, I have added a loop too so it does it 8 times. My problem is [ and I have many ] is how do I get the $letter to increase so it adds all the letters together...? I hope that made sense - Basically I need a 8 letter only random password. $i = 0 Do If Random() < 0.5 Then $Letter = Chr(Random(Asc("A"), Asc("Z"))) Else $Letter = Chr(Random(Asc("a"), Asc("z"))) Endif $i = $i + 1 Until $i = 8 Msgbox(4096, "Random Letters", $Letter)
MattX Posted January 14, 2005 Author Posted January 14, 2005 Think I've done it - I found someone elses loop: Dim $i = 0, $word = "" For $i = 1 to 10 If Random() < 0.5 Then $Letter = Chr(Random(Asc("A"), Asc("Z"))) Else $Letter = Chr(Random(Asc("a"), Asc("z"))) Endif $word = $word & $letter Next Msgbox(4096, "Random Letters", $word) Still not 100% sure how the For and Next works in this.....
herewasplato Posted January 14, 2005 Posted January 14, 2005 MattX said: Still not 100% sure how the For and Next works in this.....<{POST_SNAPBACK}>...you will get 10 random letters in the "word"...changeFor $i = 1 to 10toFor $i = 1 to 16and you will get 16 random letters in the "word"...later..... [size="1"][font="Arial"].[u].[/u][/font][/size]
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now