Created
December 15, 2021 18:39
-
-
Save m4n50n/60940b21084fd282decac6ae98508119 to your computer and use it in GitHub Desktop.
Math.random.js
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
// Returns a random integer from 0 to 9: | |
Math.floor(Math.random() * 10); | |
// Returns a random integer from 0 to 10: | |
Math.floor(Math.random() * 11); | |
// Returns a random integer from 0 to 99: | |
Math.floor(Math.random() * 100); | |
// Returns a random integer from 0 to 100: | |
Math.floor(Math.random() * 101); | |
// Returns a random integer from 1 to 10: | |
Math.floor(Math.random() * 10) + 1; | |
// Returns a random integer from 1 to 100: | |
Math.floor(Math.random() * 100) + 1; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment