NewDash

    Function random

    • Produces a random number between the inclusive lower and upper bounds. If only one argument is provided a number between 0 and the given number is returned. If floating is true, or either lower or upper are floats, a floating-point number is returned instead of an integer.

      Note: JavaScript follows the IEEE-754 standard for resolving floating-point values which can produce unexpected results.

      Parameters

      • Optionalfloating: boolean

        Specify returning a floating-point number.

      Returns number

      Returns the random number.

      5.5.0

      [[uniqueId]]

      random(0, 5)
      // => an integer between 0 and 5

      random(5)
      // => also an integer between 0 and 5

      random(5, true)
      // => a floating-point number between 0 and 5

      random(1.2, 5.2)
      // => a floating-point number between 1.2 and 5.2
    • Produces a random number between the inclusive lower and upper bounds. If only one argument is provided a number between 0 and the given number is returned. If floating is true, or either lower or upper are floats, a floating-point number is returned instead of an integer.

      Note: JavaScript follows the IEEE-754 standard for resolving floating-point values which can produce unexpected results.

      Parameters

      • Optionalupper: string | number

        The upper bound.

      • Optionalfloating: boolean

        Specify returning a floating-point number.

      Returns number

      Returns the random number.

      5.5.0

      [[uniqueId]]

      random(0, 5)
      // => an integer between 0 and 5

      random(5)
      // => also an integer between 0 and 5

      random(5, true)
      // => a floating-point number between 0 and 5

      random(1.2, 5.2)
      // => a floating-point number between 1.2 and 5.2
    • Produces a random number between the inclusive lower and upper bounds. If only one argument is provided a number between 0 and the given number is returned. If floating is true, or either lower or upper are floats, a floating-point number is returned instead of an integer.

      Note: JavaScript follows the IEEE-754 standard for resolving floating-point values which can produce unexpected results.

      Parameters

      • Optionallower: string | number

        The lower bound.

      • Optionalupper: string | number

        The upper bound.

      • Optionalfloating: boolean

        Specify returning a floating-point number.

      Returns number

      Returns the random number.

      5.5.0

      [[uniqueId]]

      random(0, 5)
      // => an integer between 0 and 5

      random(5)
      // => also an integer between 0 and 5

      random(5, true)
      // => a floating-point number between 0 and 5

      random(1.2, 5.2)
      // => a floating-point number between 1.2 and 5.2
    MMNEPVFCICPMFPCPTTAAATR