I've written a program that generates pairs of integer 3d vectors and finds the angle between them.
I save the answer (the angle) as a rational multiple of pi:
m = newRandomVector(3);
n = newRandomVector(3);
str_m = vector_to_string(m);
str_n = vector_to_string(n);
double mag1 = m.norm();
double mag2 = n.norm();
double prod = mag1 * mag2;
double cos = m.dot(n) / (mag1 * mag2);
double angle = acos (cos) * 180.0; /// PI;
sprintf(answer, "%lf/%lf * PI ", m.dot(n), prod);
However, generating random vectors crates almost exclusively float magnitudes.
How can I generate a 3D vector with an integer magnitude?