void onSphereRandom(float *x,float *y,float *z){ // 0 <= theta <= 2PI float theta = floatRand() * (2*PI); // -1 <= u <= 1 float u = (floatRand() * 2) -1.0; *x = cos(theta) * sqrt(1.0-(u*u)); *y = sin(theta) * sqrt(1.0-(u*u)); *z = u; }