randomInRange()

Get a random number within a specified range.

Arguments

Required:

min: number, max: number

Optional:

inclusive: "true true" | "false false" | "true false" | "false true"
containsDecimals: boolean

Returns

(number): Randomly generated number within specified randomInRange

Example

const randomNumSimple = randomInRange({ min: 0, max: 10 }); // Default is "inclusive, inclusive"

const randomNumWithOptions = randomInRange({
  min: 0,
  max: 10,
  inclusive: "false false",
  containsDecimals: true,
});