Last active
January 16, 2018 08:21
-
-
Save jerrymannel/1a748ab294326e4400ed16ac57fef678 to your computer and use it in GitHub Desktop.
Generate random number of given lentth
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 (_i) { | |
var i = Math.pow(10, _i - 1); | |
var j = Math.pow(10, _i) - 1; | |
return ((Math.floor(Math.random() * (j - i + 1)) + i)); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment