Created
February 10, 2019 15:56
-
-
Save christianvuerings/45df9470afa8e80a7fe2e0e181d8bf06 to your computer and use it in GitHub Desktop.
Test whether we should use `Math.floor` or `Math.round` to get a random item in an array
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
(() => { | |
const set = new Set(); | |
new Array(10000).fill('fill').map(el => { | |
set.add(Math.floor(Math.random() * temp1.length)) | |
}) | |
console.log([...set].sort()) | |
}) () |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment