Skip to content

Instantly share code, notes, and snippets.

@intelguasoft
Created July 27, 2020 05:30
Show Gist options
  • Save intelguasoft/638153ae21b3f480061a06e1912fccdd to your computer and use it in GitHub Desktop.
Save intelguasoft/638153ae21b3f480061a06e1912fccdd to your computer and use it in GitHub Desktop.
Random Integer generator (Typescript)
/**
* Generates a random integer between min and max (inclusive)
* @param {number} min
* @param {number} max
* @returns randomly generated integer
*/
public randomInt = (min: number, max: number): number => {
return Math.floor(Math.random() * (max - min + 1) + min);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment