Chobyhy 0 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 Share this post Link to post Share on other sites
SmOke_N 210 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. Share this post Link to post Share on other sites
Chobyhy 0 Posted September 3, 2006 i used those number as example. Numbers i used was 1000 to 10000 Share this post Link to post Share on other sites
SmOke_N 210 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. Share this post Link to post Share on other sites
Lemures 0 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. Share this post Link to post Share on other sites