examples/points_animation/main.js
function getRandomPointOnSphere(r) {
  var u = THREE.Math.randFloat(0, 1);
  var v = THREE.Math.randFloat(0, 1);
  var theta = 2 * Math.PI * u;
  var phi = Math.acos(2 * v - 1);
  var x = r * Math.sin(theta) * Math.sin(phi);
  var y = r * Math.cos(theta) * Math.sin(phi);
  var z = r * Math.cos(phi);
  return {
    x,
    y,
    z,
  };
}
function getRandomPointOnSphere(r) {
  var u = THREE.Math.randFloat(0, 1);
  var v = THREE.Math.randFloat(0, 1);
  var theta = 2 * Math.PI * u;
  var phi = Math.acos(2 * v - 1);
  var x = r * Math.sin(theta) * Math.sin(phi);
  var y = r * Math.cos(theta) * Math.sin(phi);
  var z = r * Math.cos(phi);
  return {
    x,
    y,
    z,
  };
}
function getRandomPointOnSphere ( r ) { var u = THREE . Math . randFloat ( 0 , 1 ) ; var v = THREE . Math . randFloat ( 0 , 1 ) ; var theta = 2 * Math . PI * u ; var phi = Math . acos ( 2 * v - 1 ) ; var x = r * Math . sin ( theta ) * Math . sin ( phi ) ; var y = r * Math . cos ( theta ) * Math . sin ( phi ) ; var z = r * Math . cos ( phi ) ; return { x , y , z , } ; }
Get a random point on a sphere

@param {Float} r Shpere radius
@returns {Object} return the point's position
Get a random point on a sphere