Ok, this should be really simple...
I just wrote this (with Unreal Engine):
float ExtX = 100.f, ExtY = 100.f;
float x = 0.f, y = 0.f;
float Radius = sqrt(FMath::SRand());
float Angle = FMath::SRand() * 2.f * PI;
x = FMath::Sin(Angle) * Radius * ExtX;
y = FMath::Cos(Angle) * Radius * ExtY;
to get evenly distributed random points on a circle or ellipse. 100.000 points placed like this look fine.
Now I want to get something similar for spheres (potentially "warped" on 3 axes)
I tried this:
float ExtX = 100.f, ExtY = 100.f, ExtZ = 100.f;
float Radius = sqrt(sqrt(FMath::SRand()));
float Angle1 = FMath::SRand() * 2.f * PI;
float Angle2 = FMath::SRand() * 2.f * PI;
x = FMath::Sin(Angle2) * FMath::Cos(Angle1) * Radius * ExtX;
y = FMath::Cos(Angle2) * FMath::Cos(Angle1) * Radius * ExtY;
z = FMath::Sin(Angle1) * Radius * ExtZ;
But points clearly have a bias towards the Z-axis now. What am I missing?