From ed2498ad097e2ed5bdeadc1a0def5c697afb8f3b Mon Sep 17 00:00:00 2001 From: Fen Dweller Date: Sun, 18 Feb 2018 14:35:44 -0500 Subject: [PATCH] Changed the random generator to only randomize a bit, and then just use the median value for the rest. Vroom --- recursive-macro.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/recursive-macro.js b/recursive-macro.js index a344f51..ef625c7 100644 --- a/recursive-macro.js +++ b/recursive-macro.js @@ -140,12 +140,19 @@ function merge_desc(list) { // maybe make this something that approximates a // normal distribution; doing this 15,000,000 times is bad... +// solution: only a few are random lul + function distribution(min, max, samples) { var result = 0; - for (var i = 0; i < samples; i++) { + var limit = Math.min(100,max) + for (var i = 0; i < limit; i++) { result += Math.floor(Math.random() * (max - min + 1) + min); } + if (limit < samples) { + result += Math.round((max - min) * (samples - limit)); + } + return result; } @@ -187,7 +194,7 @@ function defaultMerge(thing) { newThing.contents[key] = this.contents[key]; } } - + for (var key in container.contents) { if (container.contents.hasOwnProperty(key)) { if (this.contents.hasOwnProperty(key)) {