Satyrn Posted April 19, 2006 Posted April 19, 2006 Hi everyone, I'm writing a little scipt and I'd like to know how to randomize the sleep command in a specific time range. I don't want to waste time with long variables, so I hope that you could help me with an easy command.
neogia Posted April 19, 2006 Posted April 19, 2006 $min = 1 $max = 10 Sleep(Random($min, $max) * 1000) Sleeps between 1 and 10 seconds. [u]My UDFs[/u]Coroutine Multithreading UDF LibraryStringRegExp GuideRandom EncryptorArrayToDisplayString"The Brain, expecting disaster, fails to find the obvious solution." -- neogia
ELP22 Posted April 19, 2006 Posted April 19, 2006 .... AdlibEnable('_rand',2000) func _rand() sleep(random(1,9999,1)) EndFunc
Satyrn Posted April 19, 2006 Author Posted April 19, 2006 Thank you both very much for the fast reply. I'll try that right now.
herewasplato Posted April 19, 2006 Posted April 19, 2006 .... AdlibEnable('_rand',2000) func _rand() sleep(random(1,9999,1)) EndFuncI cannot say that I've ever thought of doin' it that way - but you could get quite a delay:AdlibEnable('_rand', 2000) Global $sleeptime _rand() While 1 ToolTip($sleeptime) WEnd Func _rand() $sleeptime = (Random(1, 9999, 1)) Sleep($sleeptime) EndFunc ;==>_randCreative ELP22 :-) [size="1"][font="Arial"].[u].[/u][/font][/size]
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