function minMax(rg, min, max) {
                  for (var _i = rg.length; _i-- > 0; ) {
                    var _v = rg[_i];
                    if (min > _v) min = _v;
                    if (max < _v) max = _v;
                  }
                  return { min: min, max: max };
                }
@function byte
@param {Number} v the value to scale

converts a floating-point number in the range 0-1 to a byte 0-255