-
-
Save mstefarov/4174077 to your computer and use it in GitHub Desktop.
Dicerolling!
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
namespace DiceRoll | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
Random rnd = new Random(); | |
Console.WriteLine("The rolls are as follows:"); | |
int[] amountOfThatSum = new int[11]; | |
for (int i = 1; i <= 36000; i++) | |
{ | |
int roll1 = rnd.Next(1, 7); | |
int roll2 = rnd.Next(1, 7); | |
Console.WriteLine("Roll {0}: {1} & {2}. Sum: {3}", | |
i, roll1, roll2, roll1+roll2); | |
amountOfThatSum[ roll1+roll2 ]++; | |
} | |
for (int i = 2; i <= 12; i++) | |
{ | |
Console.WriteLine("A sum of {0} was rolled {1} times.", | |
i, amountofthatsum[i-2]); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment