Sign in to follow this  
Followers 0
lolp1

A way for random letters instead of numbers?

10 posts in this topic

Didn't see a random func in the help file for letters, only numbers. Any UDF's out there for it?

Share this post


Link to post
Share on other sites



Didn't see a random func in the help file for letters, only numbers. Any UDF's out there for it?

May i ask what for?


tolle indicium

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

StringUpper(Chr(Random(65,90,1))) ;All Caps

StringLower(Chr(Random(65,90,1))) ;Not caps

Edited by Generator

Share this post


Link to post
Share on other sites

May i ask what for?

To create a random account name.

StringLower(Chr(Random(65,90,1))) ;Not caps

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

Share this post


Link to post
Share on other sites

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

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

Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

Global $Name[8]

$TimeIni=TimerInit()

For $i= 0 to UBound($Name,1)-1

$Name[$i]=StringLower(Chr(Random(65,90,1)))

Next

$Time=TimerDiff($TimeIni)

_ArrayDisplay($Name)

Share this post


Link to post
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..)

Share this post


Link to post
Share on other sites

$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

:)


Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

Works faster then I thought... thanks, works fine.

Share this post


Link to post
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
Sign in to follow this  
Followers 0