Skip to content

Instantly share code, notes, and snippets.

@oti
Created September 28, 2016 03:32
Show Gist options
  • Select an option

  • Save oti/fd048534e11a1dabc9badbfaa0163a2e to your computer and use it in GitHub Desktop.

Select an option

Save oti/fd048534e11a1dabc9badbfaa0163a2e to your computer and use it in GitHub Desktop.

Revisions

  1. oti created this gist Sep 28, 2016.
    7 changes: 7 additions & 0 deletions randomInteger.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,7 @@
    function randomInteger(range){
    retunr Math.floor(Math.random() * range);
    }
    // <range> is range of number.
    // randomInteger(2) // -> 0 or 1
    // randomInteger(10) // -> 0,1,2,3,4,5,6,7,8,9
    // randomInteger(100) // -> 0,1,2,...,98,99