I have a php script that is run once a minute. The script runs a second script, then sleeps for a given amount of time.
Right now the time is static. 20 seconds each time.
What i need to so is randomize the amount of time it sleeps. It can be more than a total of 60 seconds, but NOT less.
So here is what i have now.
$sleep1 = rand(2,18);
$sleep2 = rand(2,18);
$sleep3 = rand(2,18);
$sleep4 = rand(2,18);
if $sleep1 + $sleep2 + $sleep3 + $sleep4 <= 60 ?????????
What i need to do, is add up all the $sleep variables, and then determine is the total is less than 60. If it is, i need to increase the value of one or more of the variables to make up the difference.