code: function ReservoirBackend(options) {
      if (!(this instanceof ReservoirBackend)) {
          return new ReservoirBackend(options);
      }
  
      BaseBackend.call(this);
  
      this.backend = options.backend;
      assert(
          typeof this.backend === 'object' &&
          typeof this.backend.logMany === 'function',
          'options.backend must be object with `logMany` method'
      );
  
      this.size = options.size || 100;
      assert(
          typeof this.size === 'number' &&
          this.size >= 5 && this.size < 1000000000,
          'options.size must be number 5 >= n > 1000000000'
      );
  
      this.rangeRand = options.rangeRand || ReservoirBackend.rangeRand;
      assert(
          typeof this.rangeRand === 'function',
          'options.rangeRand must be function'
      );
  
      this.flushInterval = options.flushInterval || 50;
      assert(
          typeof this.flushInterval === 'number' &&
          this.flushInterval > 1 && this.flushInterval < 1000000,
          'options.flushInterval must be number 1 > n > 1000000'
      );
  
      this.timers = options.timers || timers;
      assert(
          typeof this.timers === 'object' &&
          typeof this.timers.setTimeout === 'function',
          'options.timers must be object with setTimeout function'
      );
  
      this.now = options.now || Date.now;
      assert(
          typeof this.now === 'function',
          'options.now must be function'
      );
  
      if (
          options.statsd &&
          typeof options.statsd.timing === 'function' &&
          typeof options.statsd.increment === 'function'
      ) {
          this.statsd = options.statsd;
      } else {
          this.statsd = {
              increment: noop,
              timing: noop
          };
      }
  
      this.clusterStatsd = options.clusterStatsd || null;
  
      this.timer = null;
      this.count = 0;
      this.records = [];
      this.dropCount = {};
      this.logCount = {};
      this.samplingDecision = null;
  }
docs: /* eslint max-statements: [0, 40]