JStone Posted October 12, 2009 Share Posted October 12, 2009 Basically, I'm looking to create a random number between two values, such as 5150ms and 6230ms. I would be using it as a sleep between a macro. Example: For $count = 1 To 5000 sleep(5000) MouseClick("left") sleep(x) ;where 'x' is a random number between 5150-6230 Next Link to comment Share on other sites More sharing options...
omikron48 Posted October 12, 2009 Share Posted October 12, 2009 (edited) Yes. Where you generate the number is based on whether you want it to change every loop or just once. To generate a number between [a,b], you just use this equation: a + R * (b - a) where R is U[0,1) (uniformly random between 0 and 1) Edited October 12, 2009 by omikron48 Link to comment Share on other sites More sharing options...
TurionAltec Posted October 12, 2009 Share Posted October 12, 2009 (edited) Random() function SRandom(Timerinit()) For $count = 1 To 5000 sleep(5000) MouseClick("left") sleep(Random(5150,6230,1)) ;where 'x' is a random number between 5150-6230 Next Edited October 12, 2009 by TurionAltec 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