@sensimods/utility-lab
    Preparing search index...

    Function randomInt

    • Generates a random integer between the specified minimum and maximum values (inclusive).

      Parameters

      • min: number

        The minimum integer value (inclusive).

      • max: number

        The maximum integer value (inclusive).

      Returns number

      A random integer between min and max.

      Will throw an error if the minimum value is greater than the maximum value.

      Will throw a TypeError if either min or max is not a finite number.

      randomInt(1, 10) // could return any integer from 1 to 10
      randomInt(5, 5) // will always return 5
      randomInt(10, 1) // throws an error