Last active
April 11, 2017 05:02
-
-
Save marclave/4fad3cdb925a6868cf30a64f71e2c37c to your computer and use it in GitHub Desktop.
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
Array.from({length: 20}, () => Math.floor(Math.random() * 1000)); | |
// Unique | |
var arr = [] | |
while(arr.length < 20){ | |
var randomnumber = Math.ceil(Math.random()*1000) | |
if(arr.indexOf(randomnumber) > -1) continue; | |
arr[arr.length] = randomnumber; | |
} | |
console.log(arr); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment