Skip to content

Instantly share code, notes, and snippets.

@takunagai
Created November 19, 2023 22:41
Show Gist options
  • Save takunagai/b58fa3483463602b1427dae6b5ec7f33 to your computer and use it in GitHub Desktop.
Save takunagai/b58fa3483463602b1427dae6b5ec7f33 to your computer and use it in GitHub Desktop.
[Returns a random integer]ランダムな整数を返す #utility
/**
* ランダムな整数を返す
* @param min 最小値
* @param max 最大値
* @returns min 以上 max 以下のランダムな整数
*/
export function getRandomInt(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