const Generator = require("./Generator");
const IntegerGenerator = require("./IntegerGenerator");
const FloatingGenerator = require("./FloatingGenerator");
const MagicFloatingGenerator = require("./MagicFloatingGenerator");
const MagicIntegerGenerator = require("./MagicIntegerGenerator");
const WeightedGenerator = require("./WeightedGenerator");
const PickoneGenerator = require("./PickoneGenerator");
const { getMagicIntegers, getMagicFloating } = require("./magicValues");

class NumberGenerator extends Generator {
  constructor({
    integer = true,
    floating = true,
    infinity = false,
    nan = false
  } = {}) {
    const options = {};
    const generators = [];

    if (floating) {
      options.floating = true;
      generators.push([new FloatingGenerator({ min: -100, max: 100 }), 30]);
      generators.push([new FloatingGenerator({ min: -10000, max: 10000 }), 20]);
      generators.push([new FloatingGenerator(), 5]);

      if (getMagicFloating().length) {
        generators.push([new MagicFloatingGenerator(), 5]);
      }
    }

    if (integer) {
      options.integer = true;
      generators.push([new IntegerGenerator({ min: -100, max: 100 }), 30]);
      generators.push([new IntegerGenerator({ min: -10000, max: 10000 }), 20]);
      generators.push([new IntegerGenerator(), 5]);
      generators.push([new PickoneGenerator([-0, +0]), 0.1]);

      if (getMagicIntegers().length) {
        generators.push([new MagicIntegerGenerator(), 5]);
        generators.push([new MagicIntegerGenerator().map(v => v + 1), 5]);
        generators.push([new MagicIntegerGenerator().map(v => v - 1), 5]);
      }
    }

    if (infinity) {
      options.infinity = true;
      generators.push([new PickoneGenerator([Infinity, -Infinity]), 0.5]);
    }

    if (nan) {
      options.nan = true;
      generators.push([NaN, 0.1]);
    }

    super("number", options);

    if (Object.keys(options).length === 0) {
      throw new Error(
        "You must include at least one of the options for the number generator: integer, floating, infinity, nan"
      );
    }

    this.composedGenerator = new WeightedGenerator(generators);
  }

  shrink(number) {
    return this.composedGenerator.shrink(number);
  }

  expand(number) {
    return this.composedGenerator.expand(number);
  }

  generate(chance, context) {
    return this.composedGenerator.generate(chance, context);
  }
}

module.exports = NumberGenerator;

@@ -400,81 +400,8 @@
 r%22);
-%0Aconst %7B getMagicIntegers, getMagicFloating %7D = require(%22./magicValues%22);
 %0A%0Acl
@@ -599,16 +599,116 @@
  = %5B%5D;%0A%0A
+    const hasInstrumentation =%0A      typeof global === %22object%22 && Boolean(global.recordLocation);%0A%0A
     if (
@@ -976,33 +976,26 @@
 if (
-getMagicFloating().length
+hasInstrumentation
 ) %7B%0A
@@ -1403,33 +1403,26 @@
 if (
-getMagicIntegers().length
+hasInstrumentation
 ) %7B%0A

Fix check for magic values in the number generator