Created
November 19, 2023 22:41
-
-
Save takunagai/b58fa3483463602b1427dae6b5ec7f33 to your computer and use it in GitHub Desktop.
[Returns a random integer]ランダムな整数を返す #utility
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* ランダムな整数を返す | |
* @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