Created
August 30, 2022 08:55
-
-
Save Margino/dcb0de89ff5ab87585009aa90cac2333 to your computer and use it in GitHub Desktop.
Getting a random number between two values
This file contains hidden or 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
| const getRandomInt = (min = 0, max = 1000) => { | |
| const random = (Math.random() * (max + 1 - min)) + min | |
| return Math.floor(random) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment