A variety of point distributions are used in computer graphics and computational geometry to test out algorithms. Below are a few common point distributions and code to generate points in 3D. Assume that random() is a random function that returns a floating point value in the range (0.0-1.0).
Uniform Distribution
Uniform distribution is the most common distribution used in practice. Generate point using random values of x, y and z.
x = random(); y = random(); z = random();
Sphere Distribution
A sphere has only surface and no volume. So, we restrict points to the surface of a sphere.
do {
x = random() - 0.5;
y = random() - 0.5;
z = random() - 0.5;
d = ( x * x ) + ( y * y ) + ( z * z );
} while ( ( d < ( 0.45 * 0.45 ) || ( d > ( 0.5 * 0.5) ) ) );
Half Sphere Distribution
Calling it a half-sphere and not a hemisphere, since it does not have the planar surface in the middle. It is just a sphere sliced off about the middle.
do {
x = random() - 0.5;
y = random() - 0.5;
z = random() - 0.5;
d = ( x * x ) + ( y * y ) + ( z * z );
} while ( ( z >= 0.2 ) || ( d < ( 0.45 * 0.45 ) ) || ( d > ( 0.5 * 0.5) ) );
Ball Distribution
A ball is a filled sphere, it is full of points inside.
do {
x = random() - 0.5;
y = random() - 0.5;
z = random() - 0.5;
d = ( x * x ) + ( y * y ) + ( z * z );
} while ( d > ( 0.49 * 0.49 ) );
Empty Ball Distribution
Empty ball is the subtraction of a ball from a cube. Everything outside the ball is filled and the inside core is empty.
do {
x = random() - 0.5;
y = random() - 0.5;
z = random() - 0.5;
d = ( x * x ) + ( y * y ) + ( z * z );
} while ( d < ( 0.45 * 0.45 ) );
Ellipsoid Distribution

Ellipsoid has a surface but no volume inside.
a = 0.5;
b = 0.5;
c = 0.2;
do {
x = random() - 0.5;
y = random() - 0.5;
z = random() - 0.5;
d = ( ( x * x ) / ( a * a ) ) + ( ( y * y ) / ( b * b ) ) + ( ( z * z ) / ( c * c ) );
} while ( ( d <= 1.4 ) || ( d >= 1.5 ) );
Pancake Distribution
Pancake is a filled ellipsoid.
a = 0.5;
b = 0.5;
c = 0.2;
do {
x = random() - 0.5;
y = random() - 0.5;
z = random() - 0.5;
d = ( ( x * x ) / ( a * a ) + ( y * y ) / ( b * b ) + ( z * z ) / ( c * c );
} while ( d >= 1.0 );
