@witchcraft/editor
    Preparing search index...
    • Returns 0 instead of the given number depending on the chance passed (0.05 by default).

      This is useful to avoid too many empty nodes without having to increase the max a lot.

      You can pass chance 0 to always return the given number.

      Parameters

      • num: number
      • chance: number = 0.05
      • getRandom: (options?: number | {}) => number = faker.number.float
          • (options?: number | {}): number
          • Returns a single random floating-point number, by default between 0.0 and 1.0. To change the range, pass a min and max value. To limit the number of decimal places, pass a multipleOf or fractionDigits parameter.

            Parameters

            • Optionaloptions: number | {}

              Upper bound or options object.

            Returns number

            When min is greater than max.

            When multipleOf is not a positive number.

            When fractionDigits is negative.

            When fractionDigits and multipleOf is passed in the same options object.

            faker.number.float() // 0.5688541042618454
            faker.number.float(3) // 2.367973240558058
            faker.number.float({ max: 100 }) // 17.3687307164073
            faker.number.float({ min: 20, max: 30 }) // 23.94764115102589
            faker.number.float({ multipleOf: 0.25, min: 0, max:10 }) // 7.75
            faker.number.float({ fractionDigits: 1 }) // 0.9
            faker.number.float({ min: 10, max: 100, multipleOf: 0.02 }) // 35.42
            faker.number.float({ min: 10, max: 100, fractionDigits: 3 }) // 65.716
            faker.number.float({ min: 10, max: 100, multipleOf: 0.001 }) // 65.716 - same as above

            8.0.0

      Returns number