Skip to content
Snippets Groups Projects
Commit f9d7e399 authored by Perttu Ahola's avatar Perttu Ahola
Browse files

Limit range of ABM timer initial value randomization

parent 3e6f824e
Branches
Tags
No related merge requests found
......@@ -213,7 +213,10 @@ ABMWithState::ABMWithState(ActiveBlockModifier *abm_):
{
// Initialize timer to random value to spread processing
float itv = abm->getTriggerInterval();
timer = myrand_range(-0.51*itv, 0.51*itv);
itv = MYMAX(0.001, itv); // No less than 1ms
int minval = MYMAX(-0.51*itv, -60); // Clamp to
int maxval = MYMIN(0.51*itv, 60); // +-60 seconds
timer = myrand_range(minval, maxval);
}
/*
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment