Skip to content

Instantly share code, notes, and snippets.

@essejose
Created June 2, 2014 13:53
Show Gist options
  • Select an option

  • Save essejose/8ee2fa3000fd1bbfbc18 to your computer and use it in GitHub Desktop.

Select an option

Save essejose/8ee2fa3000fd1bbfbc18 to your computer and use it in GitHub Desktop.

Revisions

  1. essejose created this gist Jun 2, 2014.
    13 changes: 13 additions & 0 deletions Randon Javascript
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,13 @@
    // REQUIRED
    function getRandom(x, y) {
    return Math.floor(Math.random() * (y - x + 1)) + x
    }

    // Print
    //
    var print = function (val) {
    var cartas = ['carta1','carta2','carta3','carta4','carta5', 'carta6']
    alert(cartas[val])
    }
    // Function Call
    print(getRandom(0, 5))