title: Fix the dice value based on user count
body: <p>I have a dice rolling game. I want the dice values from <code>6 to 12</code> to fall less frequently and the dice values from <code>2 to 5</code> to fall more frequently. </p>
  
  <p>The dice value should fall like the below table</p>
  
  <ul>
  <li>If UserCount is <code>600or1200or1800...</code> then the dice value should be <code>6</code></li>
  <li>If UserCount is <code>700or1400or2100...</code> then the dice value should be <code>7</code></li>
  <li>If UserCount is <code>800or1600or2400...</code> then the dice value should be <code>8</code></li>
  <li>If UserCount is <code>900or1800or2700...</code> then the dice value should be <code>9</code></li>
  <li>If UserCount is <code>1000or2000or3000...</code> then the dice value should be <code>10</code></li>
  <li>If UserCount is <code>1100or2200or3300...</code> then the dice value should be <code>11</code></li>
  <li>If UserCount is <code>1200or2400or3600...</code> then the dice value should be <code>12</code></li>
  </ul>
  
  <p>So its like If the case is 600or1200 => 6 and 1200 => 12 then the dice value should be 6 If it is 1600or2400 => 8 and 1200or2400 =>12 then the dice value should be 8</p>
  
  <p>For rest of the usercount the dice values should fall from <code>2 to 5</code> randomly.</p>
  
  <p>I roll 2 dice at a time and each one is 6 sided. When i roll the dice if it falls between 2 to 5 then i will display the same value to the user. But if it is greater than 5 then i will check for the user count and have to fix the value as specified in the question</p>
  
  <p>I maintain the user count in a <code>table</code>. This is an <code>windows application</code>.
  Kindly Help.</p>
  
  <p>I have come up with below code</p>
  
  <pre><code>public static String Roll(Int32 numberOfDice, Int32 numberOfSides, Int32 diceRolled)
          {
  
              if (numberOfDice &lt;= 0)
              {
                  throw new ApplicationException("Number of die must be greater than zero.");
              }
  
              if (numberOfSides &lt;= 0)
              {
                  throw new ApplicationException("Number of sides must be greater than zero.");
              }
  
              Random rnd = new Random((Int32)DateTime.Now.Ticks);
              StringBuilder result = new StringBuilder();
              Int32 total = 0;
  
              for (Int32 i = 1; i &lt; numberOfDice; i++)
              {
  
                  Int32 roll = rnd.Next(2, numberOfSides);
                  total += roll;
  
                  if (total &gt; 5)
                  {
                      if (diceRolled % 6 == 0)
                      {
                          total = 6;
                      }
                      else if (diceRolled % 7 == 0)
                      {
                          total = 7;
                      }
                      else if (diceRolled % 8 == 0)
                      {
                          total = 8;
                      }
                      else if (diceRolled % 9 == 0)
                      {
                          total = 9;
                      }
                      else if (diceRolled % 10 == 0)
                      {
                          total = 10;
                      }
                      else if (diceRolled % 11 == 0)
                      {
                          total = 11;
                      }
                      else if (diceRolled % 12 == 0)
                      {
                          total = 12;
                      }
                      else
                      {
                          Dice.Roll(2, 12, diceRolled);
                      }
                  }
  
              }
  
              Console.WriteLine("Total{0}", Convert.ToString(total));
  
              return Convert.ToString(total);
          }
  </code></pre>
  
  <p>Kindly suggest any improvements.</p>