Raffle Code

As promised, I’ll be raffling off one $75USD Steam digital gift cards, and two $25 cards shortly. Just to be super transparent, here’s the raffle code.

And no, I’m sure mathematically this wouldn’t hold up in a real lottery–but for a raffle with fewer than 20 valid entrants, I think we can call it good.

function rankRaffleEntrants(){
        var entrants = "Prima Secunda Tertia Quarta Quinta Sexta Septima Octavia Nina Decima"; //Steam handles
        entrants = entrants.split(" ");
        ol = document.getElementById("orderedList");
        //print function
        function addToList(entrant){
          var li = document.createElement('li');
          var nextInList = document.createTextNode(entrant);
          li.appendChild(nextInList);
          ol.appendChild(li);
        }
        while (entrants.length>1){
          var pick = Math.round(Math.random()*(entrants.length-1));
          var entrant = entrants.splice(pick,1);
          addToList(entrant);
        }
        addToList(entrants[0]);
      }

Leave a Reply

Your email address will not be published. Required fields are marked *