title: Sum of random numbers
body: <p>I'm new to Java and I'm trying to write a program that creates and sums 50 random numbers [1,3]. With my current code, I have an out put of 50 numbers side by side, but I can figure out how to add them. I tried <code>int sum = sim + i;</code> but that only doubled the number of digits created. I'm using Eclipse and appreciate any assistance.</p>
  
  <pre><code>public static void main(String[] args) {
          int n = 50;
          runSimulation(n);
  
      }
      public static void runSimulation (int n){
          for (int i = 1; i &lt;= n; i++){
              int sim = (int)(Math.random()*2.9999) + 1;
              System.out.print(sim);
          }
      }
  }
  </code></pre>