Skip to content

Instantly share code, notes, and snippets.

@rodrigograca31
Last active June 19, 2024 11:48
Show Gist options
  • Save rodrigograca31/3c6cd8b95b7d7749cac96136211c5d78 to your computer and use it in GitHub Desktop.
Save rodrigograca31/3c6cd8b95b7d7749cac96136211c5d78 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