/* randomVectorBetweenSpheres(radius: Number, depth: Number) -> THREE.Vector3 @param radius : Radius of inner sphere (distance between center of sphere and closest possible random vector) @param depth : Distance between inner sphere and outer sphere (radius+depth = furthest possible random vector) */ function randomVectorBetweenSpheres(radius, depth) { // Create random radius between radius and radius+depth const randomRadius = Math.floor(Math.random() * (radius + depth - radius + 1) + radius); // Return random vector on sphere with random radius return this.randomSphereSurfaceVector(randomRadius); }, /* randomSphereSurfaceVector(radius: Number) -> THREE.Vector3 @param radius : Radius of sphere on which to put a random vector */ function randomSphereSurfaceVector(radius) { const theta = 2 * Math.PI * Math.random(); const phi = Math.acos(2 * Math.random() - 1); const x = radius * Math.sin(phi) * Math.cos(theta); const y = radius * Math.sin(phi) * Math.sin(theta); const z = radius * Math.cos(phi); return new THREE.Vector3(x, y, z); }