Jump to content

A way for random letters instead of numbers?


 Share

Recommended Posts

  • Developers

How to generate around 6-8 random chars in one string?

Use a loop .... and append a character in every cycle of the loop.

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Use a loop .... and append a character in every cycle of the loop.

Would be fairly lengthy no? Is there a faster way?

Got an example of what you mean? Cause the way I'm thinking would take a second or two to generate 7 chars

Link to comment
Share on other sites

This is very weird there is no easier way to get a random letter of 6 characters.

The end goal is to obtain a random 6 letters in one string, and then store it to a variable. (So I can send it later on)

Send($variable..)

Link to comment
Share on other sites

  • Developers

$tm = TimerInit()
$String1 = GetRandomString(6,8)
$String2 = GetRandomString(6,8)
ConsoleWrite("Time:" & TimerDiff($tm) & "   String1:" & $String1 & "   String2:" & $String2 & @CRLF)

Func GetRandomString($min=1,$max=8)
    Local $retString
    For $x = 1 to int(Random($min,$max+1)-.5)
        $retString &= StringLower(Chr(Random(65,90,1)))
    Next
    Return $retString
EndFunc

:)

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

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