From 57a546d4e8fdcc15d15ccd0b76c9f2f622ebc61f Mon Sep 17 00:00:00 2001 From: Fen Dweller Date: Sun, 22 Dec 2019 09:23:20 -0500 Subject: [PATCH] Make handling of victims in excess of the random limit a bit more variable --- recursive-macro.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/recursive-macro.js b/recursive-macro.js index d835713..c927c09 100644 --- a/recursive-macro.js +++ b/recursive-macro.js @@ -416,10 +416,11 @@ function fill_area(area, weights, variance=0.15) ++loopvar; } - // if we're doing more than 100 victims, then we randomly + // if we're doing more than the limit, then we just add on the rest, with some variance if (limit < max) { - count += Math.round((max/limit) * candidate.weight); + const base = (max-limit) * candidate.weight; + count += Math.round(base - base / 10 + base * Math.random() / 5); } area -= count * candidate.area;