Skip to content

Instantly share code, notes, and snippets.

@jerrymannel
Last active January 16, 2018 08:21
Show Gist options
  • Save jerrymannel/1a748ab294326e4400ed16ac57fef678 to your computer and use it in GitHub Desktop.
Save jerrymannel/1a748ab294326e4400ed16ac57fef678 to your computer and use it in GitHub Desktop.
Generate random number of given lentth
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