title: Triangular distribution in Java
body: <p>I have 4 parts, every part 10000 times, which should fit into case, and the dimensions of the parts are given by uniform, normal and triangular distribution by randomly generating numbers in added dimensions of each distribution.</p>
  
  <p>For each 4 parts there is decision if they fit or not. But that shouldn't be a problem.</p>
  
  <p>I've managed somehow to do uniform and normal distribution:</p>
  
  <pre><code>public double uniformDistrubution(double min, double max) {
      Random rand = new Random();
      return Math.random() * max + min;
  }
  
  public double normalDistrubution(double mean, double std) {
      Random rng = new Random();
      return mean + std * rng.nextGaussian();
  }
  </code></pre>
  
  <p>But I cannot figure out the triangular one. I've the dimensions for it:</p>
  
  <blockquote>
    <p>a = 7:6, b = 8:0, c = 8:4</p>
  </blockquote>