Skip to content

Instantly share code, notes, and snippets.

@andersonmadeira
Created April 19, 2017 13:31
Show Gist options
  • Save andersonmadeira/284a10b7e9a8faf91391f5d6447c769a to your computer and use it in GitHub Desktop.
Save andersonmadeira/284a10b7e9a8faf91391f5d6447c769a to your computer and use it in GitHub Desktop.
Make Random Array of Numbers
(function(numberOfElements, digits) { return new Array(numberOfElements).fill(0).map(function f(v) { return Math.floor( Math.random() * (digits == 1 ? 10 : Math.pow(10, digits)) + (digits == 1 ? 0 : Math.pow(10, digits)) ); } ); })(10,1);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment