logmein Posted June 13, 2009 Share Posted June 13, 2009 Parameters $length : the max length of string $number : 1 include numer; 0 not include Return value Suceed : Random string Failure : -1 While 1 Sleep (1000) ConsoleWrite (_RandomText (10,1) & @CRLF) WEnd Func _RandomText ($length,$number) Local $return Local $n[36] = ['q','w','e','r','t','y','u','i','o','a','s','d','f','g','h','j','k','l','z','x','c','v','b','n','m','p','1','2','3','4','5','6','7','8','9','0'] If $number = '' or $number = 0 Then For $i = 1 to $length $return &= $n[Random (0,26,1)] Next Return $return ElseIf $number = 1 For $i = 1 to $length $return &= $n[Random (0,35,1)] Next Return $return Else Return -1 EndIf EndFunc All comments are welcome!!! [font=arial, helvetica, sans-serif][s]Total USB Security 3.0 Beta[/s] | [s]Malware Kill[/s] | Malware Scanner | Screen Hider | Locker | Matrix Generator[s]AUTO-SYNC 1.0 | MD5 Hash Generator | URL Checker | Tube Take [/s]| Random Text[/font] Link to comment Share on other sites More sharing options...
Valuater Posted June 13, 2009 Share Posted June 13, 2009 Might want to look at this in a new light... While 1 Sleep(1000) ConsoleWrite(_RandomText(10) & @CRLF) WEnd Func _RandomText($length) $text = "" For $i = 1 To $length $text &= Chr(Random(65, 90, 1)) Next Return $text EndFunc ;==>_RandomText 8) Link to comment Share on other sites More sharing options...
corgano Posted June 13, 2009 Share Posted June 13, 2009 Might want to look at this in a new light... While 1 Sleep(1000) ConsoleWrite(_RandomText(10) & @CRLF) WEnd Func _RandomText($length) $text = "" For $i = 1 To $length $text &= Chr(Random(65, 90, 1)) Next Return $text EndFunc ;==>_RandomText 8) Just wanted to point out what he did. (For anyone new who sees this) Instead of haveing a array of letters, he had it pick a random number (between the one assinged to a and the one assinged to z) and had it convert the number to the leter it represents. It repeats this untill it has the required amount of letters. 0x616e2069646561206973206c696b652061206d616e20776974686f7574206120626f64792c20746f206669676874206f6e6520697320746f206e657665722077696e2e2e2e2e Link to comment Share on other sites More sharing options...
Rogue5099 Posted February 3, 2010 Share Posted February 3, 2010 Upper and lower case letters... While 1 Sleep(1000) ConsoleWrite(_RandomText(10) & @CRLF) WEnd Func _RandomText($length) $text = "" For $i = 1 To $length $temp = Random(65, 122, 1) While $temp >= 90 And $temp <= 96 $temp = Random(65, 122, 1) WEnd $temp = Chr($temp) $text &= $temp Next Return $text EndFunc ;==>_RandomText My projects: Inventory / Mp3 Inventory, Computer Stats Link to comment Share on other sites More sharing options...
jaberwacky Posted February 4, 2010 Share Posted February 4, 2010 Text cannot be random, other wise it wouldn't be text. Helpful Posts and Websites: AutoIt3 Variables and Function Parameters MHz | AutoIt Wiki | Using the GUIToolTip UDF BrewManNH | Can't find what you're looking for on the Forum? Link to comment Share on other sites More sharing options...
Achilles Posted February 4, 2010 Share Posted February 4, 2010 Text cannot be randomSays jabberwocky vince77 1 My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list] Link to comment Share on other sites More sharing options...
Minikori Posted February 4, 2010 Share Posted February 4, 2010 Text cannot be random, other wise it wouldn't be text.LCBHkhvcgjkyBKcyMind blown? For those who are asking questions, look in the help file first. I'm tired of people asking stupid questions about how to do things when 10 seconds in the help file could solve their problem.[quote name='JRowe' date='24 January 2010 - 05:58 PM' timestamp='1264381100' post='766337'][quote name='beerman' date='24 January 2010 - 03:28 PM' timestamp='1264372082' post='766300']They already have a punishment system for abuse.[/quote]... and his his name is Valik.[/quote]www.minikori.com Link to comment Share on other sites More sharing options...
NerdFencer Posted February 5, 2010 Share Posted February 5, 2010 (edited) Upper and lower case letters... While 1 Sleep(1000) ConsoleWrite(_RandomText(10) & @CRLF) WEnd Func _RandomText($length) $text = "" For $i = 1 To $length $temp = Random(65, 122, 1) While $temp >= 90 And $temp <= 96 $temp = Random(65, 122, 1) WEnd $temp = Chr($temp) $text &= $temp Next Return $text EndFunc ;==>_RandomText You are over-thinking the issue, let the numbers do the work for you. (Upper and Lower) I also made it conform to MustDeclareVars (about 25% faster) While 1 Sleep(1000) ConsoleWrite(_RandomText(10) & @CRLF) WEnd Func _RandomText($length) Local $text = "", $temp For $i = 1 To $length $temp = Random(65, 116, 1) $text&= Chr($temp+6*($temp>90)) Next Return $text EndFunc ;==>_RandomText Here is another version that includes numbers as well. While 1 Sleep(1000) ConsoleWrite(_RandomText(10) & @CRLF) WEnd Func _RandomText($length) Local $text = "", $temp For $i = 1 To $length $temp = Random(55, 116, 1) $text&= Chr($temp+6*($temp>90)-7*($temp<65)) Next Return $text EndFunc ;==>_RandomText Edit: added (about 25% faster) from my quick side-by-side speed test Edited February 5, 2010 by NerdFencer _________[u]UDFs[/u]_________-Mouse UDF-Math UDF-Misc Constants-Uninstaller Shell Link to comment Share on other sites More sharing options...
logmein Posted February 7, 2010 Author Share Posted February 7, 2010 Thank's NerdFencer! [font=arial, helvetica, sans-serif][s]Total USB Security 3.0 Beta[/s] | [s]Malware Kill[/s] | Malware Scanner | Screen Hider | Locker | Matrix Generator[s]AUTO-SYNC 1.0 | MD5 Hash Generator | URL Checker | Tube Take [/s]| Random Text[/font] Link to comment Share on other sites More sharing options...
engjcowi Posted October 27, 2010 Share Posted October 27, 2010 (edited) anyway we can have quote of the day?? or random quote? Edited October 27, 2010 by engjcowi Drunken Frat-Boy Monkey Garbage Link to comment Share on other sites More sharing options...
jaberwacky Posted October 27, 2010 Share Posted October 27, 2010 (edited) "It is mankind's discovery of language which more than any other single thing has separated him from the animal creation. Without language, what concept have we of past or future as separated from the immediate present? Without language, how can we tell anyone what we feel, or what we think? It might be said that until he developed language, man had no soul, for without language how could he reach deep inside himself and discover the truths that are hidden there, or find out what emotions he shared, or did not share, with his fellow men and women. But because this greatest gift of all gifts is in daily use, and is smeared, and battered and trivialized by commonplace associations, we too often forget the splendour of which it is capable, and the pleasures that it can give, from the pen of a master. " - Robertson Davies Edited October 27, 2010 by jaberwocky6669 Helpful Posts and Websites: AutoIt3 Variables and Function Parameters MHz | AutoIt Wiki | Using the GUIToolTip UDF BrewManNH | Can't find what you're looking for on the Forum? Link to comment Share on other sites More sharing options...
czardas Posted October 27, 2010 Share Posted October 27, 2010 "It is mankind's discovery of language which more than any other single thing has separated him from the animal creation. Without language, what concept have we of past or future as separated from the immediate present? Without language, how can we tell anyone what we feel, or what we think? It might be said that until he developed language, man had no soul, for without language how could he reach deep inside himself and discover the truths that are hidden there, or find out what emotions he shared, or did not share, with his fellow men and women. But because this greatest gift of all gifts is in daily use, and is smeared, and battered and trivialized by commonplace associations, we too often forget the splendour of which it is capable, and the pleasures that it can give, from the pen of a master. " - Robertson DaviesWell I disagree with Robertson Davies. Language wasn't discovered, it evolves. It's also not unique to mankind. I guess this is more a topic for the chat forum. Hmm! operator64Â Â ArrayWorkshop Link to comment Share on other sites More sharing options...
jaberwacky Posted October 27, 2010 Share Posted October 27, 2010 Well, the guy above me asked for a random quote and so I obliged him. Helpful Posts and Websites: AutoIt3 Variables and Function Parameters MHz | AutoIt Wiki | Using the GUIToolTip UDF BrewManNH | Can't find what you're looking for on the Forum? Link to comment Share on other sites More sharing options...
engjcowi Posted October 27, 2010 Share Posted October 27, 2010 Lol i was hoping the program could be adapted to give a random quote so i could then have a quote of the day. Ive got a load i could make a text or ini file. But thank you for that quote ill add it to my collection Drunken Frat-Boy Monkey Garbage Link to comment Share on other sites More sharing options...
jaberwacky Posted October 27, 2010 Share Posted October 27, 2010 I knew that I was just being a smart a*s. =P Helpful Posts and Websites: AutoIt3 Variables and Function Parameters MHz | AutoIt Wiki | Using the GUIToolTip UDF BrewManNH | Can't find what you're looking for on the Forum? Link to comment Share on other sites More sharing options...
Zibit Posted October 28, 2010 Share Posted October 28, 2010 well for a first UDF it isnt the worst. but yeah there are like millions of ways to do this function in a different way. Creator Of Xtreme DevelopersPixel Pattern UDFTray GUI UDFMathssend & recive register scriptMouse Control via Webcam Link to comment Share on other sites More sharing options...
jchd Posted March 4, 2022 Share Posted March 4, 2022 You should have created your own thread instead of resurrecting this one after 10 years! Populate your text array(s) and use Random(0, UBound($array) - 1, 1) as index to pick a random text entry. This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt) Link to comment Share on other sites More sharing options...
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