Browse Source

Fix a very silly error that was serious reducing the variance of victim selection.

Rather than starting at 0 and working up to a limit, a counter was...starting at the
limit. This removed a lot of variance!
tags/v1.1.2
Fen Dweller 5 years ago
parent
commit
40aa6c599f
1 changed files with 1 additions and 6 deletions
  1. +1
    -6
      recursive-macro.js

+ 1
- 6
recursive-macro.js View File

@@ -395,7 +395,7 @@ function fill_area(area, weights, variance=0.15)
var limit = Math.min(max, 100);

var count = 0;
var loopvar = limit;
var loopvar = 0;

// for small amounts, actually do the randomness

@@ -403,11 +403,6 @@ function fill_area(area, weights, variance=0.15)

// if we have nothing at all, it's even better!

if (limit > 0 && result.length == 0) {
++count;
++loopvar;
}

while (loopvar < limit) {
if (loopvar <= clusters[candidate.name] && loopvar == 0 && Math.random() < cluster_chances[candidate.name]) {
++count;


Loading…
Cancel
Save