GitHub 6248★

Generate a random integer in given range

JavaScript version

const randomInteger = (min, max) => Math.floor(Math.random() * (max - min + 1)) + min;

TypeScript version

const randomInteger = (min: number, max: number): number => Math.floor(Math.random() * (max - min + 1)) + min;
Follow me on and to get more useful contents.