Picking point from a sphere with uniform distribution
const u = Math.random() * r;
const v = 2 * Math.random() - 1; // to radians
const theta = 2 * Math.PI * Math.random(); // to radians
const ro = Math.cbrt(u);
const sin_phi = Math.sqrt(1 - v * v);
const x = ro * sin_phi * Math.cos(theta);
const y = ro * sin_phi * Math.sin(theta)
const z = ro * v;