Skip to content

Instantly share code, notes, and snippets.

@christianvuerings
Created February 10, 2019 15:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save christianvuerings/45df9470afa8e80a7fe2e0e181d8bf06 to your computer and use it in GitHub Desktop.
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
(() => {
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