zutto Posted August 26, 2008 Share Posted August 26, 2008 yeah i know howto use with letters & numbers.. but i have no idea howto use with - and +.. need for my script to chose randomly between + and - :S any ideas? Link to comment Share on other sites More sharing options...
PsaltyDS Posted August 26, 2008 Share Posted August 26, 2008 (edited) yeah i know howto use with letters & numbers..but i have no idea howto use with - and +.. need for my script to chose randomly between + and - :Sany ideas?$sSign = "+"If Random(0,1,1) Then $sSign = "-" Or, since we're having a geek fest with this:$sSign = Chr(43 + (2 * Random(0,1,1))) Or the SmOke_N way:$sSign = StringRegExpReplace("+-", "(\+)(\-)", "\" & Random(1,2,1)) Edit: Rats! He already posted it! Edited August 26, 2008 by PsaltyDS Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
Developers Jos Posted August 26, 2008 Developers Share Posted August 26, 2008 If Random(1,3) > 2 Then $sign = "-" Else $sign = "+" EndIf 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 More sharing options...
Moderators SmOke_N Posted August 26, 2008 Moderators Share Posted August 26, 2008 yeah i know howto use with letters & numbers.. but i have no idea howto use with - and +.. need for my script to chose randomly between + and - :S any ideas?Local $a_add_sub[2] = ["-", "+"] MsgBox(0, "", Execute( 8 & $a_add_sub[Random(0, 1, 1)] & 10)) Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Developers Jos Posted August 26, 2008 Developers Share Posted August 26, 2008 (edited) There must be more options than these .. Edited August 26, 2008 by Jos 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 More sharing options...
Moderators SmOke_N Posted August 26, 2008 Moderators Share Posted August 26, 2008 $sSign = Chr(43 + (2 * Random(0,1,1))) There must be more options than these .. Someone say geek? MsgBox(0, 0, StringRegExpReplace("-+", "(.)(.)", "\" & Random(1, 2, 1))) Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
weaponx Posted August 26, 2008 Share Posted August 26, 2008 I don't like casting the sign to character. If you have a given number and you want its sign to randomly change then... $num = 666 If Random(0,1,1) Then $num *= -1 ConsoleWrite($num & @CRLF) Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted August 26, 2008 Moderators Share Posted August 26, 2008 I don't like casting the sign to character. If you have a given number and you want its sign to randomly change then... $num = 666 If Random(0,1,1) Then $num *= -1 ConsoleWrite($num & @CRLF)I used this method with bcx. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Bert Posted August 26, 2008 Share Posted August 26, 2008 Someone say geek? MsgBox(0, 0, StringRegExpReplace("-+", "(.)(.)", "\" & Random(1, 2, 1)))No, we are recovering geeks. The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted August 26, 2008 Moderators Share Posted August 26, 2008 (edited) No, we are recovering geeks. I don't go to meetings...Edit:And I never made it past step 1 anyway! Edited August 26, 2008 by SmOke_N Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
weaponx Posted August 26, 2008 Share Posted August 26, 2008 Someone say geek? MsgBox(0, 0, StringRegExpReplace("-+", "(.)(.)", "\" & Random(1, 2, 1))) Wouldn't this have been simpler with StringMid you regex nerd? Link to comment Share on other sites More sharing options...
Developers Jos Posted August 26, 2008 Developers Share Posted August 26, 2008 (edited) I still prefer the "normal" approach Still don't like to regex thingies when relaxing after a days work. StringMid("-+",Random(1,2,1),1) Edit: i see I am not the only one that likes the sweet and simple approach Edited August 26, 2008 by Jos 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 More sharing options...
Moderators SmOke_N Posted August 26, 2008 Moderators Share Posted August 26, 2008 I still prefer the "normal" approach Still don't like to regex thingies when relaxing after a days work.StringMid("-+",Random(1,2,1),1)Edit: i see I am not the only one that likes the sweet and simple approach Wouldn't this have been simpler with StringMid you regex nerd?Why use 10 string functions when you only need 1? I may be the nerd, but at least I'm consistent Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
weaponx Posted August 26, 2008 Share Posted August 26, 2008 Why use 10 string functions when you only need 1? I may be the nerd, but at least I'm consistent When you say 10, that is binary right? Link to comment Share on other sites More sharing options...
Bert Posted August 26, 2008 Share Posted August 26, 2008 @SmoKE - You are at a meeting! what do you think this forum is? The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted August 26, 2008 Moderators Share Posted August 26, 2008 When you say 10, that is binary right?Missing a few chars there for binary I think ... Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted August 26, 2008 Moderators Share Posted August 26, 2008 @SmoKE - You are at a meeting! what do you think this forum is? Hell I'm the president of my chapter then. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Szhlopp Posted August 26, 2008 Share Posted August 26, 2008 Someone say geek? MsgBox(0, 0, StringRegExpReplace("-+", "(.)(.)", "\" & Random(1, 2, 1))) RegEx/RegExRep Tester!Nerd Olympics - Community App!Login UDFMemory UDF - "Game.exe+753EC" - CE pointer to AU3Password Manager W/ SourceDataFiler - Include files in your au3!--- Was I helpful? Click the little green '+' Link to comment Share on other sites More sharing options...
Richard Robertson Posted August 26, 2008 Share Posted August 26, 2008 Nay, I say you should find the length of the memory space for the running application, then read a random location in the application. If the value is < 128, then it's negative, if >= 128, positive. Sorry, I don't have a code example because I just got my hand slammed in a truck door and I can't type really well yet. Link to comment Share on other sites More sharing options...
Szhlopp Posted August 26, 2008 Share Posted August 26, 2008 Nay, I say you should find the length of the memory space for the running application, then read a random location in the application. If the value is < 128, then it's negative, if >= 128, positive. Sorry, I don't have a code example because I just got my hand slammed in a truck door and I can't type really well yet. Good Idea! I'll add that to this after I eat lunch $random = Random(Random(Random(Random(Random(0,1,1), 2, 1), Random(0,1,1), 1) + 1, 2, 1), Random(Random(Random(Random(0,1,1), 2, 1), _ Random(0,1,1), 1) + 1, 2, 1), 1) + Random(Random(Random(Random(Random(0,1,1), 2, 1), Random(0,1,1), 1) + 1, 2, 1), _ Random(Random(Random(Random(0,1,1), 2, 1), Random(0,1,1), 1) + 1, 2, 1), 1) + Random(Random(Random(Random(Random(0,1,1), 2, 1), Random(0,1,1), 1) + 1, 2, 1), Random(Random(Random(Random(0,1,1), 2, 1), _ Random(0,1,1), 1) + 1, 2, 1), 1) + Random(Random(Random(Random(Random(0,1,1), 2, 1), Random(0,1,1), 1) + 1, 2, 1), _ Random(Random(Random(Random(0,1,1), 2, 1), Random(0,1,1), 1) + 1, 2, 1), 1) + 5 + Random(Random(Random(Random(Random(0,1,1), 2, 1), Random(0,1,1), 1) + 1, 2, 1), Random(Random(Random(Random(0,1,1), 2, 1), _ Random(0,1,1), 1) + 1, 2, 1), 1) + Random(Random(Random(Random(Random(0,1,1), 2, 1), Random(0,1,1), 1) + 1, 2, 1), _ Random(Random(Random(Random(0,1,1), 2, 1), Random(0,1,1), 1) + 1, 2, 1), 1) + Random(Random(Random(Random(Random(0,1,1), 2, 1), Random(0,1,1), 1) + 1, 2, 1), Random(Random(Random(Random(0,1,1), 2, 1), _ Random(0,1,1), 1) + 1, 2, 1), 1) + Random(Random(Random(Random(Random(0,1,1), 2, 1), Random(0,1,1), 1) + 1, 2, 1), _ Random(Random(Random(Random(0,1,1), 2, 1), Random(0,1,1), 1) + 1, 2, 1), 1) / 2 + Random(Random(Random(Random(Random(0,1,1), 2, 1), Random(0,1,1), 1) + 1, 2, 1), Random(Random(Random(Random(0,1,1), 2, 1), _ Random(0,1,1), 1) + 1, 2, 1), 1) + Random(Random(Random(Random(Random(0,1,1), 2, 1), Random(0,1,1), 1) + 1, 2, 1), _ Random(Random(Random(Random(0,1,1), 2, 1), Random(0,1,1), 1) + 1, 2, 1), 1) + Random(Random(Random(Random(Random(0,1,1), 2, 1), Random(0,1,1), 1) + 1, 2, 1), Random(Random(Random(Random(0,1,1), 2, 1), _ Random(0,1,1), 1) + 1, 2, 1), 1) + Random(Random(Random(Random(Random(0,1,1), 2, 1), Random(0,1,1), 1) + 1, 2, 1), _ Random(Random(Random(Random(0,1,1), 2, 1), Random(0,1,1), 1) + 1, 2, 1), 1) + Random(Random(Random(Random(Random(0,1,1), 2, 1), Random(0,1,1), 1) + 1, 2, 1), Random(Random(Random(Random(0,1,1), 2, 1), _ Random(0,1,1), 1) + 1, 2, 1), 1) + Random(Random(Random(Random(Random(0,1,1), 2, 1), Random(0,1,1), 1) + 1, 2, 1), _ Random(Random(Random(Random(0,1,1), 2, 1), Random(0,1,1), 1) + 1, 2, 1), 1) + Random(Random(Random(Random(Random(0,1,1), 2, 1), Random(0,1,1), 1) + 1, 2, 1), Random(Random(Random(Random(0,1,1), 2, 1), _ Random(0,1,1), 1) + 1, 2, 1), 1) + Random(Random(Random(Random(Random(0,1,1), 2, 1), Random(0,1,1), 1) + 1, 2, 1), _ Random(Random(Random(Random(0,1,1), 2, 1), Random(0,1,1), 1) + 1, 2, 1), 1) + 5 + Random(Random(Random(Random(Random(0,1,1), 2, 1), Random(0,1,1), 1) + 1, 2, 1), Random(Random(Random(Random(0,1,1), 2, 1), _ Random(0,1,1), 1) + 1, 2, 1), 1) + Random(Random(Random(Random(Random(0,1,1), 2, 1), Random(0,1,1), 1) + 1, 2, 1), _ Random(Random(Random(Random(0,1,1), 2, 1), Random(0,1,1), 1) + 1, 2, 1), 1) + Random(Random(Random(Random(Random(0,1,1), 2, 1), Random(0,1,1), 1) + 1, 2, 1), Random(Random(Random(Random(0,1,1), 2, 1), _ Random(0,1,1), 1) + 1, 2, 1), 1) + Random(Random(Random(Random(Random(0,1,1), 2, 1), Random(0,1,1), 1) + 1, 2, 1), _ Random(Random(Random(Random(0,1,1), 2, 1), Random(0,1,1), 1) + 1, 2, 1), 1) / 2 + Random(Random(Random(Random(Random(0,1,1), 2, 1), Random(0,1,1), 1) + 1, 2, 1), Random(Random(Random(Random(0,1,1), 2, 1), _ Random(0,1,1), 1) + 1, 2, 1), 1) + Random(Random(Random(Random(Random(0,1,1), 2, 1), Random(0,1,1), 1) + 1, 2, 1), _ Random(Random(Random(Random(0,1,1), 2, 1), Random(0,1,1), 1) + 1, 2, 1), 1) + Random(Random(Random(Random(Random(0,1,1), 2, 1), Random(0,1,1), 1) + 1, 2, 1), Random(Random(Random(Random(0,1,1), 2, 1), _ Random(0,1,1), 1) + 1, 2, 1), 1) + Random(Random(Random(Random(Random(0,1,1), 2, 1), Random(0,1,1), 1) + 1, 2, 1), _ Random(Random(Random(Random(0,1,1), 2, 1), Random(0,1,1), 1) + 1, 2, 1), 1) If $random > 20 Then $random = StringMid("-+",Random(1,2,1),1) & 1 ElseIf $random > 10 Then $random = 0 EndIf MsgBox(0, "", $random) RegEx/RegExRep Tester!Nerd Olympics - Community App!Login UDFMemory UDF - "Game.exe+753EC" - CE pointer to AU3Password Manager W/ SourceDataFiler - Include files in your au3!--- Was I helpful? Click the little green '+' 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