Jump to content

Little help with Random


MattX
 Share

Recommended Posts

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)
Link to comment
Share on other sites

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.....

Link to comment
Share on other sites

Still not 100% sure how the For and Next works in this.....

<{POST_SNAPBACK}>

...you will get 10 random letters in the "word"...

change

For $i = 1 to 10

to

For $i = 1 to 16

and you will get 16 random letters in the "word"...

later.....

[size="1"][font="Arial"].[u].[/u][/font][/size]

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...