title: Generating random graph coordinates
body: <p>The below code will generate two random points on a graph (canvas) which could be connected with a line.</p>
  
  <pre><code>&lt;script&gt;
  function random() {
  var point1X = (Math.floor(Math.random() * 10) + 1);
  var point1Y = (Math.floor(Math.random() * 2) - 10); // first two lines generate first coordinate on graph
  var point2X = (Math.floor(Math.random() * 100) + 10);
  var point2Y = (Math.floor(Math.random() * 2) - 10); // second two lines generate second point
  
  document.getElementById("empty").innerHTML += "(" + point1X + ", " + point1Y + ") (" +      point2X + ", " + point2Y + ")&lt;br /&gt;"; // here coordinates are displayed on the page.
  }
  &lt;/script&gt;
  </code></pre>
  
  <p>I want the second coordinates generated to be equivalent to the third coordinates made since everything should be connected using lines (however the fourth coordinates generated should be different).</p>
  
  <p>I'm finding this very difficult to explain so hopefully this diagram should help: <a href="http://i6.minus.com/jKIhdChUNWZt7.png" rel="nofollow">http://i6.minus.com/jKIhdChUNWZt7.png</a>.</p>
  
  <p>If anyone can explain this clearly, I'll edit this.</p>