1
0
Fork 0

Added sampling of static options

This commit is contained in:
Joost De Cock 2018-09-07 16:25:17 +02:00
parent 829baa469b
commit 164c40c695
2 changed files with 3 additions and 2 deletions

View file

@ -147,7 +147,9 @@ Pattern.prototype.sampleOption = function(optionName) {
let parts = this.sampleParts();
let option = this.config.options[optionName];
if (typeof option.min === "undefined" || typeof option.max === "undefined") {
throw "Cannot sample an option without min and max values";
let min = option * 0.9;
let max = option * 1.1;
option = { min, max };
}
if (typeof option.pct !== "undefined") factor = 100;
val = option.min / factor;