Skip to content

Instantly share code, notes, and snippets.

@jigar1101
Created September 12, 2018 06:32
Show Gist options
  • Save jigar1101/cc8b203f9dc552eff10cc96555b00d2d to your computer and use it in GitHub Desktop.
Save jigar1101/cc8b203f9dc552eff10cc96555b00d2d to your computer and use it in GitHub Desktop.
Generating an array with random Numbers
function generateRandomNumbers(count, start, end) {
const arr = [];
for (var i=0; i<count; i++) {
arr.push(Math.round(Math.random() * (end-start)))
}
return arr;
}
// Generates an array of length 100000 with random numbers between 0 to 100
generateRandomNumbers(100000, 0, 100);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment