lolp1 0 Posted August 4, 2007 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
Glyph 2 Posted August 4, 2007 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
Generator 0 Posted August 4, 2007 (edited) StringUpper(Chr(Random(65,90,1))) ;All Caps StringLower(Chr(Random(65,90,1))) ;Not caps Edited August 4, 2007 by Generator Share this post Link to post Share on other sites
lolp1 0 Posted August 4, 2007 May i ask what for?To create a random account name.StringLower(Chr(Random(65,90,1))) ;Not capsHow to generate around 6-8 random chars in one string? Share this post Link to post Share on other sites
Jos 2,280 Posted August 4, 2007 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. Share this post Link to post Share on other sites
lolp1 0 Posted August 4, 2007 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
Generator 0 Posted August 4, 2007 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
lolp1 0 Posted August 4, 2007 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
Jos 2,280 Posted August 4, 2007 $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. Share this post Link to post Share on other sites
lolp1 0 Posted August 4, 2007 Works faster then I thought... thanks, works fine. Share this post Link to post Share on other sites