Created
September 12, 2018 06:32
-
-
Save jigar1101/cc8b203f9dc552eff10cc96555b00d2d to your computer and use it in GitHub Desktop.
Generating an array with random Numbers
This file contains 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 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