[Javascript] Two Six Sided Dice Code (NOW STOP PM'ing ME ASKING FOR IT!!!)

Discussion in 'Web Programming' started by Anet390, Dec 10, 2011.

[Javascript] Two Six Sided Dice Code (NOW STOP PM'ing ME ASKING FOR IT!!!)
  1. Unread #1 - Dec 10, 2011 at 4:28 AM
  2. Anet390
    Joined:
    Jun 3, 2010
    Posts:
    2,223
    Referrals:
    1
    Sythe Gold:
    291
    Cryptocurrency Discussion Participant Paper Trading Competition Participant

    Anet390 Grand Master
    $5 USD Donor New

    [Javascript] Two Six Sided Dice Code (NOW STOP PM'ing ME ASKING FOR IT!!!)

    HERE IT IS:
    Code:
    <script type="text/javascript">
    
      function rollDie(sides)
      {
        if(!sides) sides = 6;
        with(Math) return 1 + floor(random() * sides);
      }
    
      function rollDice(number, sides)
      {
        var total = 0;
        while(number-- > 0) total += rollDie(sides);
        return total;
      }
    
    </script>
    Then call your dice in an alert or something by using (# of dice, # of sides per dice)
     
  3. Unread #2 - Dec 10, 2011 at 6:49 PM
  4. X4NRSA
    Joined:
    Sep 18, 2009
    Posts:
    1,314
    Referrals:
    1
    Sythe Gold:
    68
    Discord Unique ID:
    142446005034549248
    Discord Username:
    cout6254
    Potamus Pokémon Trainer

    X4NRSA Korean snob
    $100 USD Donor New

    [Javascript] Two Six Sided Dice Code (NOW STOP PM'ing ME ASKING FOR IT!!!)

    thanks for this
     
  5. Unread #3 - Dec 10, 2011 at 6:57 PM
  6. Anet390
    Joined:
    Jun 3, 2010
    Posts:
    2,223
    Referrals:
    1
    Sythe Gold:
    291
    Cryptocurrency Discussion Participant Paper Trading Competition Participant

    Anet390 Grand Master
    $5 USD Donor New

    [Javascript] Two Six Sided Dice Code (NOW STOP PM'ing ME ASKING FOR IT!!!)

    No Problem! Ask if you want anything!
     
< Webmaster needed! | LF web-designer for a simple newspaper site >

Users viewing this thread
1 guest


 
 
Adblock breaks this site