Created
September 22, 2019 07:13
-
-
Save gthrm/f679b5046a7c7ca1576a9e36dba9ea72 to your computer and use it in GitHub Desktop.
randomInteger function
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
function randomInteger(min, max) { | |
// случайное число от min до (max+1) | |
let rand = min + Math.random() * (max + 1 - min); | |
return Math.floor(rand); | |
} | |
console.log( randomInteger(1, 3) ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment