Chobyhy Posted September 3, 2006 Share Posted September 3, 2006 I need a way to create random sleep time. Random between two chosen number like the random function. I've tried sleep(random(1,10)) or something like that but it didnt work Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted September 3, 2006 Moderators Share Posted September 3, 2006 Remember that Sleep uses Milliseconds... The default Sleep if you use any number I believe is 10, so whether you use 1 to 10, it's the same as using 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...
Chobyhy Posted September 3, 2006 Author Share Posted September 3, 2006 i used those number as example. Numbers i used was 1000 to 10000 Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted September 3, 2006 Moderators Share Posted September 3, 2006 Test your own theory that it's not working... ConsoleWrite(@LF) While 1 $iTimer = TimerInit() $iRand = Random(1000, 10000, 1) ToolTip('Random Time = ' & $iRand, 0, 0) Sleep($iRand) ConsoleWrite('The Pause was: ' & TimerDiff($iTimer) / 1000 & @LF) WEndRun it in SciTe... and it will show you the approximate output. 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...
Lemures Posted September 3, 2006 Share Posted September 3, 2006 I need a way to create random sleep time. Random between two chosen number like the random function. I've tried sleep(random(1,10)) or something like that but it didnt work .... SleepRan(1000) ;sleep for 1 second, with a 20% variance. .... .... Func SleepRan($n) $v = .2 ;variance. currently set to 20% Sleep(Random($n*(1-$v),$n*(1+$v),1)) EndFunc Try that. 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