title: Three.js list of random points
body: <p><strong>Beginner question:</strong>
  I create some random points in java script. How can I later "call" each single one of them? I believe it was called an Object (the list of all points), where I can manipulate their position in the list or "pull" the ones I need. How do I do that in js?</p>
  
  <p>what is the line: </p>
  
  <p><code>var dots = [];</code> for?
  The comment after that was added from another person and I don't get it.</p>
  
  <p>How can I make a line between two points (let's say the first and second from the list - the 0 and the 1)  in Three.js?</p>
  
  <p><strong>More complicated question:</strong>  I create here X (in this case 20) random points in java script. I am trying to figure out a way to randomly create faces using groups of 3 points and form a mesh.</p>
  
  <p>Well, not so randomly, because I need a result, where all faces bind together in a continuous mesh. The result should look like a terrain poly-surface made out of the many vertex points.</p>
  
  <p>What rules should be applied? 
  <a href="https://i.stack.imgur.com/fVbKN.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/fVbKN.png" alt="enter image description here"></a></p>
  
  <pre><code>var numpoints = 20;
  var dots = []; //If you want to use for other task
  
  for (var i = 0 ; i &lt; numpoints ; i++) {
      var x = Math.random() * (80 - 1) + 1  //Math.random() * (max - min) + min
      var y = Math.random() * (80 - 1) + 1
      var z = Math.random() * (10 - 1) + 1
  
      var dotGeometry = new THREE.Geometry();
      dots.push(dotGeometry);
      dotGeometry.vertices.push(new THREE.Vector3(x, y, z));
      var dotMaterial = new THREE.PointCloudMaterial( { size: 3, sizeAttenuation: false, color: 0xFF0000 });
      var dot = new THREE.PointCloud( dotGeometry, dotMaterial);
      scene.add(dot);
  }
  </code></pre>