Skip to content

Random

Helper functions that have to do with getting random values.

function getRandomInt(min, max, exceptions?): number;

Defined in: functions/random.ts:25

This returns a random integer between min and max. It is inclusive on both ends.

For example:

const oneTwoOrThree = getRandomInt(1, 3);
Parameter Type Default value Description
min number undefined The lower bound for the random number (inclusive).
max number undefined The upper bound for the random number (inclusive).
exceptions readonly number[] [] Optional. An array of elements that will be skipped over when getting the random integer. For example, a min of 1, a max of 4, and an exceptions array of [2] would cause the function to return either 1, 3, or 4. Default is an empty array.

number