Monday 15 April 2013

java - Is this algorithm possbile? Randomizes execution times within a fixed time period -



java - Is this algorithm possbile? Randomizes execution times within a fixed time period -

i'm churning brains trying think of simple way (algorithm) next scenario:

i wish run tests 24 hours. there 3 kinds of test. each test must executed percentage of time. each test must take random length of time complete.

now, if exclude lastly part - random time length - , prepare length of time each test fine. random test time, how can ensure indeed right number executed in 24 hours? seems me need know in advance length of time each test can work out many tests in total need!

any ideas?

i misunderstanding, looking like:

int numberofsecondsforfirsttest = rand(86400); //86400 = number of seconds in 24 hours. int numberofsecondsforsecondtest = rand(86400 - numberofsecondsforfirsttest); int numberofsecondsforthirdtest = 86400 - numberofsecondsforfirsttest - numberofsecondsforsecondtest;

this give 24 hours worth of testing time 3 different tests sec precision.

java algorithm testing

No comments:

Post a Comment