Jump to content

Help With creating Random Sleeptime


Chobyhy
 Share

Recommended Posts

  • Moderators

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

  • Moderators

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)
WEnd
Run 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

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...